@ngrok/mantle 0.15.4 → 0.16.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.
package/assets/mantle.css CHANGED
@@ -1,3 +1,6 @@
1
+ /* import for webpack support in crusty */
2
+ @import "sonner/dist/styles.css";
3
+
1
4
  /* Euclid Square */
2
5
  @font-face {
3
6
  font-family: EuclidSquare;
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ComponentPropsWithoutRef } from 'react';
4
4
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
5
- import { I as IconProps } from './icon-uC5dwP06.js';
5
+ import { a as IconProps } from './icon-D6P9AESZ.js';
6
6
  import './types-BuKAGhC-.js';
7
7
 
8
8
  declare const Accordion: react.ForwardRefExoticComponent<ComponentPropsWithoutRef<react.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & react.RefAttributes<HTMLDivElement>>> & react.RefAttributes<HTMLDivElement>>;
@@ -3,13 +3,14 @@ import * as class_variance_authority from 'class-variance-authority';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import * as react from 'react';
5
5
  import { ComponentProps, ReactNode } from 'react';
6
+ import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
6
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
- import * as DialogPrimitive from '@radix-ui/react-dialog';
8
+ import { R as Root } from './primitive-hud69IM9.js';
8
9
  import { S as SvgAttributes } from './types-BuKAGhC-.js';
9
10
 
10
11
  declare const priorities: readonly ["info", "danger"];
11
12
  type Priority = (typeof priorities)[number];
12
- type AlertDialogProps = ComponentProps<typeof DialogPrimitive.Root> & {
13
+ type AlertDialogProps = ComponentProps<typeof Root> & {
13
14
  /**
14
15
  * Indicates the importance or impact level of the AlertDialog, affecting its
15
16
  * color and styling to communicate its purpose to the user.
@@ -26,13 +27,13 @@ declare namespace AlertDialog {
26
27
  /**
27
28
  * A button that opens the Alert Dialog.
28
29
  */
29
- declare const AlertDialogTrigger: react.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
30
+ declare const AlertDialogTrigger: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
30
31
  /**
31
32
  * The popover alert dialog container.
32
33
  *
33
34
  * Renders on top of the overlay and is centered in the viewport.
34
35
  */
35
- declare const AlertDialogContent: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
36
+ declare const AlertDialogContent: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_dialog.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
36
37
  /**
37
38
  * Contains the main content of the dialog.
38
39
  */
@@ -60,14 +61,14 @@ declare const AlertDialogFooter: {
60
61
  * Alternatively, you can provide `aria-label` or `aria-labelledby` to
61
62
  * `AlertDialogContent` and exclude this component.
62
63
  */
63
- declare const AlertDialogTitle: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
64
+ declare const AlertDialogTitle: react.ForwardRefExoticComponent<Omit<_radix_ui_react_dialog.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
64
65
  /**
65
66
  * An accessible description to be announced when the dialog is opened.
66
67
  *
67
68
  * Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and
68
69
  * exclude this component.
69
70
  */
70
- declare const AlertDialogDescription: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
71
+ declare const AlertDialogDescription: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_dialog.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
71
72
  /**
72
73
  * A button that confirms the Alert Dialog action.
73
74
  * Will default to appearance="filled", as well as the priority color from the `AlertDialog`.
@@ -1,2 +1,2 @@
1
- import{b as m}from"./chunk-MJVZHJQA.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import{a as p}from"./chunk-VJPVAY5J.js";import{a as l}from"./chunk-EW5CFGXT.js";import{Info as h}from"@phosphor-icons/react/Info";import{Warning as B}from"@phosphor-icons/react/Warning";import*as i from"@radix-ui/react-dialog";import{createContext as T,forwardRef as n,useContext as E}from"react";import w from"tiny-invariant";import{jsx as o,jsxs as z}from"react/jsx-runtime";var g=T(null);function c(){let t=E(g);return w(t,"AlertDialog child component used outside of AlertDialog parent!"),t}function d({priority:t,...e}){return o(g.Provider,{value:{priority:t},children:o(i.Root,{...e})})}d.displayName="AlertDialog";var I=i.Trigger,O=i.Portal,f=n(({className:t,...e},r)=>o(i.Overlay,{className:l("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:r}));f.displayName="AlertDialogOverlay";var D=n(({className:t,...e},r)=>z(O,{children:[o(f,{}),o("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:o(i.Content,{ref:r,className:l("flex w-full max-w-md 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",t),...e})})]}));D.displayName="AlertDialogContent";var A=({className:t,...e})=>o("div",{className:l("flex-1 space-y-4",t),...e});A.displayName="AlertDialogBody";var y=({className:t,...e})=>o("div",{className:l("flex flex-col space-y-2 text-center sm:text-start",t),...e});y.displayName="AlertDialogHeader";var u=({className:t,...e})=>o("div",{className:l("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});u.displayName="AlertDialogFooter";var P=n(({className:t,...e},r)=>o(i.Title,{ref:r,className:l("text-strong text-center text-xl font-medium sm:text-start sm:text-lg",t),...e}));P.displayName="AlertDialogTitle";var v=n(({className:t,...e},r)=>o(i.Description,{ref:r,className:l("text-body text-center text-base font-normal sm:text-start sm:text-sm",t),...e}));v.displayName="AlertDialogDescription";var x=n(({appearance:t="filled",...e},r)=>{let s=c(),a="default";return s.priority==="danger"&&(a="danger"),o(m,{appearance:t,priority:a,ref:r,...e})});x.displayName="AlertDialogAction";var C=n(({appearance:t="outlined",className:e,priority:r="neutral",...s},a)=>o(i.Close,{asChild:!0,children:o(m,{appearance:t,className:l("mt-2 sm:mt-0",e),priority:r,ref:a,...s})}));C.displayName="AlertDialogCancel";var N=n(({className:t,svg:e,...r},s)=>{let a=c(),R=a.priority==="danger"?"text-danger-600":"text-accent-600",b=a.priority==="danger"?o(B,{}):o(h,{});return o(p,{ref:s,className:l("size-12 sm:size-7",R,t),svg:e??b,...r})});N.displayName="AlertDialogIcon";export{d as AlertDialog,x as AlertDialogAction,A as AlertDialogBody,C as AlertDialogCancel,D as AlertDialogContent,v as AlertDialogDescription,u as AlertDialogFooter,y as AlertDialogHeader,N as AlertDialogIcon,P as AlertDialogTitle,I as AlertDialogTrigger};
1
+ import{a as c,b as d,c as f,d as D,e as A,f as y,g as u,h as P}from"./chunk-J4X3ODX7.js";import{g as p}from"./chunk-CD26UMMG.js";import"./chunk-273VK4KO.js";import"./chunk-D3XF6J5A.js";import{b as m}from"./chunk-MJVZHJQA.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import{a as g}from"./chunk-VJPVAY5J.js";import{a as r}from"./chunk-EW5CFGXT.js";import{Info as W}from"@phosphor-icons/react/Info";import{Warning as F}from"@phosphor-icons/react/Warning";import{createContext as H,forwardRef as s,useContext as S}from"react";import j from"tiny-invariant";import{jsx as o,jsxs as q}from"react/jsx-runtime";var v=H(null);function x(){let t=S(v);return j(t,"AlertDialog child component used outside of AlertDialog parent!"),t}function C({priority:t,...e}){return o(v.Provider,{value:{priority:t},children:o(c,{...e})})}C.displayName="AlertDialog";var V=d,k=f,N=s(({className:t,...e},i)=>o(A,{className:r("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:i}));N.displayName="AlertDialogOverlay";var R=s(({className:t,onInteractOutside:e,onPointerDownOutside:i,...a},l)=>q(k,{children:[o(N,{}),o("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:o(y,{ref:l,className:r("flex w-full max-w-md 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",t),onInteractOutside:n=>{p(n),e?.(n)},onPointerDownOutside:n=>{p(n),i?.(n)},...a})})]}));R.displayName="AlertDialogContent";var b=({className:t,...e})=>o("div",{className:r("flex-1 space-y-4",t),...e});b.displayName="AlertDialogBody";var h=({className:t,...e})=>o("div",{className:r("flex flex-col space-y-2 text-center sm:text-start",t),...e});h.displayName="AlertDialogHeader";var O=({className:t,...e})=>o("div",{className:r("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});O.displayName="AlertDialogFooter";var B=s(({className:t,...e},i)=>o(u,{ref:i,className:r("text-strong text-center text-xl font-medium sm:text-start sm:text-lg",t),...e}));B.displayName="AlertDialogTitle";var I=s(({className:t,...e},i)=>o(P,{ref:i,className:r("text-body text-center text-base font-normal sm:text-start sm:text-sm",t),...e}));I.displayName="AlertDialogDescription";var T=s(({appearance:t="filled",...e},i)=>{let a=x(),l="default";return a.priority==="danger"&&(l="danger"),o(m,{appearance:t,priority:l,ref:i,...e})});T.displayName="AlertDialogAction";var w=s(({appearance:t="outlined",className:e,priority:i="neutral",...a},l)=>o(D,{asChild:!0,children:o(m,{appearance:t,className:r("mt-2 sm:mt-0",e),priority:i,ref:l,...a})}));w.displayName="AlertDialogCancel";var E=s(({className:t,svg:e,...i},a)=>{let l=x(),n=l.priority==="danger"?"text-danger-600":"text-accent-600",z=l.priority==="danger"?o(F,{}):o(W,{});return o(g,{ref:a,className:r("size-12 sm:size-7",n,t),svg:e??z,...i})});E.displayName="AlertDialogIcon";export{C as AlertDialog,T as AlertDialogAction,b as AlertDialogBody,w as AlertDialogCancel,R as AlertDialogContent,I as AlertDialogDescription,O as AlertDialogFooter,h as AlertDialogHeader,E as AlertDialogIcon,B as AlertDialogTitle,V as AlertDialogTrigger};
2
2
  //# sourceMappingURL=alert-dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { Info } from \"@phosphor-icons/react/Info\";\nimport { Warning } from \"@phosphor-icons/react/Warning\";\nimport * as AlertDialogPrimitive from \"@radix-ui/react-dialog\";\nimport {\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n\ttype ComponentProps,\n\ttype ComponentPropsWithoutRef,\n\ttype ElementRef,\n\ttype ReactNode,\n} from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Button, type ButtonPriority, type ButtonProps } from \"../button/button.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\n\nconst priorities = [\"info\", \"danger\"] as const;\ntype Priority = (typeof priorities)[number];\n\ntype AlertDialogContextValue = {\n\tpriority: Priority;\n};\n\nconst AlertDialogContext = createContext<AlertDialogContextValue | null>(null);\n\nfunction useAlertDialogContext() {\n\tconst context = useContext(AlertDialogContext);\n\tinvariant(context, \"AlertDialog child component used outside of AlertDialog parent!\");\n\treturn context;\n}\n\ntype AlertDialogProps = ComponentProps<typeof AlertDialogPrimitive.Root> & {\n\t/**\n\t * Indicates the importance or impact level of the AlertDialog, affecting its\n\t * color and styling to communicate its purpose to the user.\n\t */\n\tpriority: Priority;\n};\n\n/**\n * The root component for the Alert Dialog\n */\nfunction AlertDialog({ priority, ...props }: AlertDialogProps) {\n\treturn (\n\t\t<AlertDialogContext.Provider value={{ priority }}>\n\t\t\t<AlertDialogPrimitive.Root {...props} />\n\t\t</AlertDialogContext.Provider>\n\t);\n}\nAlertDialog.displayName = \"AlertDialog\";\n\n/**\n * A button that opens the Alert Dialog.\n */\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\n/**\n * A layer that covers the inert portion of the view when the dialog is open.\n */\nconst AlertDialogOverlay = forwardRef<\n\tElementRef<typeof AlertDialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Overlay\n\t\tclassName={cx(\n\t\t\t\"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\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t\tref={ref}\n\t/>\n));\nAlertDialogOverlay.displayName = \"AlertDialogOverlay\";\n\n/**\n * The popover alert dialog container.\n *\n * Renders on top of the overlay and is centered in the viewport.\n */\nconst AlertDialogContent = forwardRef<\n\tElementRef<typeof AlertDialogPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPortal>\n\t\t<AlertDialogOverlay />\n\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t<AlertDialogPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full max-w-md flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start\",\n\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\"p-6\",\n\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t</AlertDialogPortal>\n));\nAlertDialogContent.displayName = \"AlertDialogContent\";\n\n/**\n * Contains the main content of the dialog.\n */\nconst AlertDialogBody = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div className={cx(\"flex-1 space-y-4\", className)} {...props} />\n);\nAlertDialogBody.displayName = \"AlertDialogBody\";\n\n/**\n * Contains the header content of the dialog, including the title and description.\n */\nconst AlertDialogHeader = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div className={cx(\"flex flex-col space-y-2 text-center sm:text-start\", className)} {...props} />\n);\nAlertDialogHeader.displayName = \"AlertDialogHeader\";\n\n/**\n * Contains the footer content of the dialog, including the action and cancel buttons.\n */\nconst AlertDialogFooter = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div className={cx(\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\", className)} {...props} />\n);\nAlertDialogFooter.displayName = \"AlertDialogFooter\";\n\n/**\n * An accessible name to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-label` or `aria-labelledby` to\n * `AlertDialogContent` and exclude this component.\n */\nconst AlertDialogTitle = forwardRef<\n\tElementRef<typeof AlertDialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\"text-strong text-center text-xl font-medium sm:text-start sm:text-lg\", className)}\n\t\t{...props}\n\t/>\n));\nAlertDialogTitle.displayName = \"AlertDialogTitle\";\n\n/**\n * An accessible description to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and\n * exclude this component.\n */\nconst AlertDialogDescription = forwardRef<\n\tElementRef<typeof AlertDialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Description\n\t\tref={ref}\n\t\tclassName={cx(\"text-body text-center text-base font-normal sm:text-start sm:text-sm\", className)}\n\t\t{...props}\n\t/>\n));\nAlertDialogDescription.displayName = \"AlertDialogDescription\";\n\n/**\n * A button that confirms the Alert Dialog action.\n * Will default to appearance=\"filled\", as well as the priority color from the `AlertDialog`.\n * Does not close the alert dialog by default.\n *\n * These buttons should be distinguished visually from the AlertDialogCancel button.\n *\n * Composes around the mantle Button component.\n */\nconst AlertDialogAction = forwardRef<ElementRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"filled\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tlet buttonPriority: NonNullable<ButtonPriority> = \"default\";\n\t\tif (ctx.priority === \"danger\") {\n\t\t\tbuttonPriority = \"danger\";\n\t\t}\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t//\n\t\t\t\tappearance={appearance}\n\t\t\t\tpriority={buttonPriority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogAction.displayName = \"AlertDialogAction\";\n\n/**\n * A button that closes the dialog and cancels the action.\n * Will default to appearance=\"outlined\" and priority=\"neutral\".\n *\n * This button should be distinguished visually from AlertDialogAction buttons.\n *\n * Composes around the mantle Button component.\n */\nconst AlertDialogCancel = forwardRef<ElementRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"outlined\",\n\t\t\tclassName,\n\t\t\tpriority = \"neutral\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<AlertDialogPrimitive.Close asChild>\n\t\t\t<Button\n\t\t\t\tappearance={appearance}\n\t\t\t\tclassName={cx(\"mt-2 sm:mt-0\", className)}\n\t\t\t\tpriority={priority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</AlertDialogPrimitive.Close>\n\t),\n);\nAlertDialogCancel.displayName = \"AlertDialogCancel\";\n\ntype AlertDialogIconProps = Omit<SvgAttributes, \"children\"> & {\n\tsvg?: ReactNode;\n};\n\n/**\n * An icon that visually represents the priority of the AlertDialog.\n *\n * Defaults to a warning icon for danger priority and an info icon for info\n * priority with the appropriate color.\n *\n * Can be overridden with a custom icon using the `svg` prop.\n */\nconst AlertDialogIcon = forwardRef<ElementRef<\"svg\">, AlertDialogIconProps>(({ className, svg, ...props }, ref) => {\n\tconst ctx = useAlertDialogContext();\n\tconst defaultColor = ctx.priority === \"danger\" ? \"text-danger-600\" : \"text-accent-600\";\n\tconst defaultIcon = ctx.priority === \"danger\" ? <Warning /> : <Info />;\n\n\treturn (\n\t\t<SvgOnly\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"size-12 sm:size-7\", defaultColor, className)}\n\t\t\tsvg={svg ?? defaultIcon}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogIcon.displayName = \"AlertDialogIcon\";\n\nexport {\n\t//,\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogBody,\n\tAlertDialogCancel,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAl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P,EACV,IAAKQ,EACJ,GAAGP,EACL,EACD,CAEF,EACAqB,EAAkB,YAAc,oBAchC,IAAMC,EAAkBjB,EAAoD,CAAC,CAAE,UAAAC,EAAW,IAAAiB,EAAK,GAAGvB,CAAM,EAAGO,IAAQ,CAClH,IAAMW,EAAMxB,EAAsB,EAC5B8B,EAAeN,EAAI,WAAa,SAAW,kBAAoB,kBAC/DO,EAAcP,EAAI,WAAa,SAAWjB,EAACyB,EAAA,EAAQ,EAAKzB,EAAC0B,EAAA,EAAK,EAEpE,OACC1B,EAAC2B,EAAA,CACA,IAAKrB,EACL,UAAWC,EAAG,oBAAqBgB,EAAclB,CAAS,EAC1D,IAAKiB,GAAOE,EACX,GAAGzB,EACL,CAEF,CAAC,EACDsB,EAAgB,YAAc","names":["Info","Warning","AlertDialogPrimitive","createContext","forwardRef","useContext","invariant","jsx","jsxs","AlertDialogContext","createContext","useAlertDialogContext","context","useContext","invariant","AlertDialog","priority","props","jsx","AlertDialogTrigger","AlertDialogPortal","AlertDialogOverlay","forwardRef","className","ref","cx","AlertDialogContent","jsxs","AlertDialogBody","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","AlertDialogDescription","AlertDialogAction","appearance","ctx","buttonPriority","Button","AlertDialogCancel","AlertDialogIcon","svg","defaultColor","defaultIcon","Warning","Info","SvgOnly"]}
1
+ {"version":3,"sources":["../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { Info } from \"@phosphor-icons/react/Info\";\nimport { Warning } from \"@phosphor-icons/react/Warning\";\nimport {\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n\ttype ComponentProps,\n\ttype ComponentPropsWithoutRef,\n\ttype ElementRef,\n\ttype ReactNode,\n} from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Button, type ButtonPriority, type ButtonProps } from \"../button/button.js\";\nimport * as AlertDialogPrimitive from \"../dialog/primitive.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { preventCloseOnPromptInteraction } from \"../toast/toast.js\";\n\nconst priorities = [\"info\", \"danger\"] as const;\ntype Priority = (typeof priorities)[number];\n\ntype AlertDialogContextValue = {\n\tpriority: Priority;\n};\n\nconst AlertDialogContext = createContext<AlertDialogContextValue | null>(null);\n\nfunction useAlertDialogContext() {\n\tconst context = useContext(AlertDialogContext);\n\tinvariant(context, \"AlertDialog child component used outside of AlertDialog parent!\");\n\treturn context;\n}\n\ntype AlertDialogProps = ComponentProps<typeof AlertDialogPrimitive.Root> & {\n\t/**\n\t * Indicates the importance or impact level of the AlertDialog, affecting its\n\t * color and styling to communicate its purpose to the user.\n\t */\n\tpriority: Priority;\n};\n\n/**\n * The root component for the Alert Dialog\n */\nfunction AlertDialog({ priority, ...props }: AlertDialogProps) {\n\treturn (\n\t\t<AlertDialogContext.Provider value={{ priority }}>\n\t\t\t<AlertDialogPrimitive.Root {...props} />\n\t\t</AlertDialogContext.Provider>\n\t);\n}\nAlertDialog.displayName = \"AlertDialog\";\n\n/**\n * A button that opens the Alert Dialog.\n */\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\n/**\n * A layer that covers the inert portion of the view when the dialog is open.\n */\nconst AlertDialogOverlay = forwardRef<\n\tElementRef<typeof AlertDialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Overlay\n\t\tclassName={cx(\n\t\t\t\"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\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t\tref={ref}\n\t/>\n));\nAlertDialogOverlay.displayName = \"AlertDialogOverlay\";\n\n/**\n * The popover alert dialog container.\n *\n * Renders on top of the overlay and is centered in the viewport.\n */\nconst AlertDialogContent = forwardRef<\n\tElementRef<typeof AlertDialogPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>(({ className, onInteractOutside, onPointerDownOutside, ...props }, ref) => (\n\t<AlertDialogPortal>\n\t\t<AlertDialogOverlay />\n\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t<AlertDialogPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full max-w-md flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start\",\n\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\"p-6\",\n\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonInteractOutside={(event) => {\n\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\tonInteractOutside?.(event);\n\t\t\t\t}}\n\t\t\t\tonPointerDownOutside={(event) => {\n\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\tonPointerDownOutside?.(event);\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t</AlertDialogPortal>\n));\nAlertDialogContent.displayName = \"AlertDialogContent\";\n\n/**\n * Contains the main content of the dialog.\n */\nconst AlertDialogBody = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div className={cx(\"flex-1 space-y-4\", className)} {...props} />\n);\nAlertDialogBody.displayName = \"AlertDialogBody\";\n\n/**\n * Contains the header content of the dialog, including the title and description.\n */\nconst AlertDialogHeader = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div className={cx(\"flex flex-col space-y-2 text-center sm:text-start\", className)} {...props} />\n);\nAlertDialogHeader.displayName = \"AlertDialogHeader\";\n\n/**\n * Contains the footer content of the dialog, including the action and cancel buttons.\n */\nconst AlertDialogFooter = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div className={cx(\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\", className)} {...props} />\n);\nAlertDialogFooter.displayName = \"AlertDialogFooter\";\n\n/**\n * An accessible name to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-label` or `aria-labelledby` to\n * `AlertDialogContent` and exclude this component.\n */\nconst AlertDialogTitle = forwardRef<\n\tElementRef<typeof AlertDialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\"text-strong text-center text-xl font-medium sm:text-start sm:text-lg\", className)}\n\t\t{...props}\n\t/>\n));\nAlertDialogTitle.displayName = \"AlertDialogTitle\";\n\n/**\n * An accessible description to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and\n * exclude this component.\n */\nconst AlertDialogDescription = forwardRef<\n\tElementRef<typeof AlertDialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Description\n\t\tref={ref}\n\t\tclassName={cx(\"text-body text-center text-base font-normal sm:text-start sm:text-sm\", className)}\n\t\t{...props}\n\t/>\n));\nAlertDialogDescription.displayName = \"AlertDialogDescription\";\n\n/**\n * A button that confirms the Alert Dialog action.\n * Will default to appearance=\"filled\", as well as the priority color from the `AlertDialog`.\n * Does not close the alert dialog by default.\n *\n * These buttons should be distinguished visually from the AlertDialogCancel button.\n *\n * Composes around the mantle Button component.\n */\nconst AlertDialogAction = forwardRef<ElementRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"filled\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tlet buttonPriority: NonNullable<ButtonPriority> = \"default\";\n\t\tif (ctx.priority === \"danger\") {\n\t\t\tbuttonPriority = \"danger\";\n\t\t}\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t//\n\t\t\t\tappearance={appearance}\n\t\t\t\tpriority={buttonPriority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogAction.displayName = \"AlertDialogAction\";\n\n/**\n * A button that closes the dialog and cancels the action.\n * Will default to appearance=\"outlined\" and priority=\"neutral\".\n *\n * This button should be distinguished visually from AlertDialogAction buttons.\n *\n * Composes around the mantle Button component.\n */\nconst AlertDialogCancel = forwardRef<ElementRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"outlined\",\n\t\t\tclassName,\n\t\t\tpriority = \"neutral\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<AlertDialogPrimitive.Close asChild>\n\t\t\t<Button\n\t\t\t\tappearance={appearance}\n\t\t\t\tclassName={cx(\"mt-2 sm:mt-0\", className)}\n\t\t\t\tpriority={priority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</AlertDialogPrimitive.Close>\n\t),\n);\nAlertDialogCancel.displayName = \"AlertDialogCancel\";\n\ntype AlertDialogIconProps = Omit<SvgAttributes, \"children\"> & {\n\tsvg?: ReactNode;\n};\n\n/**\n * An icon that visually represents the priority of the AlertDialog.\n *\n * Defaults to a warning icon for danger priority and an info icon for info\n * priority with the appropriate color.\n *\n * Can be overridden with a custom icon using the `svg` prop.\n */\nconst AlertDialogIcon = forwardRef<ElementRef<\"svg\">, AlertDialogIconProps>(({ className, svg, ...props }, ref) => {\n\tconst ctx = useAlertDialogContext();\n\tconst defaultColor = ctx.priority === \"danger\" ? \"text-danger-600\" : \"text-accent-600\";\n\tconst defaultIcon = ctx.priority === \"danger\" ? <Warning /> : <Info />;\n\n\treturn (\n\t\t<SvgOnly\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"size-12 sm:size-7\", defaultColor, className)}\n\t\t\tsvg={svg ?? defaultIcon}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogIcon.displayName = \"AlertDialogIcon\";\n\nexport {\n\t//,\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogBody,\n\tAlertDialogCancel,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogIcon,\n\tAlertDialogTitle,\n\tAlertDialogTrigger,\n};\n"],"mappings":"iaAEA,OAAS,QAAAA,MAAY,6BACrB,OAAS,WAAAC,MAAe,gCACxB,OACC,iBAAAC,EACA,cAAAC,EACA,cAAAC,MAKM,QACP,OAAOC,MAAe,iBAqCnB,cAAAC,EAwCF,QAAAC,MAxCE,oBAtBH,IAAMC,EAAqBC,EAA8C,IAAI,EAE7E,SAASC,GAAwB,CAChC,IAAMC,EAAUC,EAAWJ,CAAkB,EAC7C,OAAAK,EAAUF,EAAS,iEAAiE,EAC7EA,CACR,CAaA,SAASG,EAAY,CAAE,SAAAC,EAAU,GAAGC,CAAM,EAAqB,CAC9D,OACCC,EAACT,EAAmB,SAAnB,CAA4B,MAAO,CAAE,SAAAO,CAAS,EAC9C,SAAAE,EAAsBC,EAArB,CAA2B,GAAGF,EAAO,EACvC,CAEF,CACAF,EAAY,YAAc,cAK1B,IAAMK,EAA0CC,EAE1CC,EAAyCC,EAKzCC,EAAqBC,EAGzB,CAAC,CAAE,UAAAC,EAAW,GAAGT,CAAM,EAAGU,IAC3BT,EAAsBU,EAArB,CACA,UAAWC,EACV,iKACAH,CACD,EACC,GAAGT,EACJ,IAAKU,EACN,CACA,EACDH,EAAmB,YAAc,qBAOjC,IAAMM,EAAqBL,EAGzB,CAAC,CAAE,UAAAC,EAAW,kBAAAK,EAAmB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AAuB,YAAc,yBAWrC,IAAME,EAAoBnB,EACzB,CACC,CAEC,WAAAoB,EAAa,SACb,GAAG5B,CACJ,EACAU,IACI,CACJ,IAAMmB,EAAMnC,EAAsB,EAC9BoC,EAA8C,UAClD,OAAID,EAAI,WAAa,WACpBC,EAAiB,UAIjB7B,EAAC8B,EAAA,CAEA,WAAYH,EACZ,SAAUE,EACV,IAAKpB,EACJ,GAAGV,EACL,CAEF,CACD,EACA2B,EAAkB,YAAc,oBAUhC,IAAMK,EAAoBxB,EACzB,CACC,CAEC,WAAAoB,EAAa,WACb,UAAAnB,EACA,SAAAV,EAAW,UACX,GAAGC,CACJ,EACAU,IAEAT,EAAsBgC,EAArB,CAA2B,QAAO,GAClC,SAAAhC,EAAC8B,EAAA,CACA,WAAYH,EACZ,UAAWhB,EAAG,eAAgBH,CAAS,EACvC,SAAUV,EACV,IAAKW,EACJ,GAAGV,EACL,EACD,CAEF,EACAgC,EAAkB,YAAc,oBAchC,IAAME,EAAkB1B,EAAoD,CAAC,CAAE,UAAAC,EAAW,IAAA0B,EAAK,GAAGnC,CAAM,EAAGU,IAAQ,CAClH,IAAMmB,EAAMnC,EAAsB,EAC5B0C,EAAeP,EAAI,WAAa,SAAW,kBAAoB,kBAC/DQ,EAAcR,EAAI,WAAa,SAAW5B,EAACqC,EAAA,EAAQ,EAAKrC,EAACsC,EAAA,EAAK,EAEpE,OACCtC,EAACuC,EAAA,CACA,IAAK9B,EACL,UAAWE,EAAG,oBAAqBwB,EAAc3B,CAAS,EAC1D,IAAK0B,GAAOE,EACX,GAAGrC,EACL,CAEF,CAAC,EACDkC,EAAgB,YAAc","names":["Info","Warning","createContext","forwardRef","useContext","invariant","jsx","jsxs","AlertDialogContext","createContext","useAlertDialogContext","context","useContext","invariant","AlertDialog","priority","props","jsx","Root","AlertDialogTrigger","Trigger","AlertDialogPortal","Portal","AlertDialogOverlay","forwardRef","className","ref","Overlay","cx","AlertDialogContent","onInteractOutside","onPointerDownOutside","jsxs","Content","event","preventCloseOnPromptInteraction","AlertDialogBody","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","appearance","ctx","buttonPriority","Button","AlertDialogCancel","Close","AlertDialogIcon","svg","defaultColor","defaultIcon","Warning","Info","SvgOnly"]}
package/dist/button.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as c}from"./chunk-2YAPDW3F.js";import{a as b}from"./chunk-7AUDKKSM.js";import{b as a}from"./chunk-MJVZHJQA.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import"./chunk-EW5CFGXT.js";export{a as Button,c as ButtonGroup,b as IconButton};
1
+ import{a as c}from"./chunk-2YAPDW3F.js";import{a as b}from"./chunk-BU7JVIWF.js";import{b as a}from"./chunk-MJVZHJQA.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import"./chunk-EW5CFGXT.js";export{a as Button,c as ButtonGroup,b as IconButton};
2
2
  //# sourceMappingURL=button.js.map
@@ -0,0 +1,34 @@
1
+ import{a as T}from"./chunk-D3XF6J5A.js";import{Fragment as P,jsx as i,jsxs as k}from"react/jsx-runtime";var v="https://assets.ngrok.com",q=`${v}/fonts`,R=["/euclid-square/EuclidSquare-Regular-WebS.woff","/euclid-square/EuclidSquare-RegularItalic-WebS.woff","/euclid-square/EuclidSquare-Medium-WebS.woff","/euclid-square/EuclidSquare-Semibold-WebS.woff","/euclid-square/EuclidSquare-MediumItalic-WebS.woff","/ibm-plex-mono/IBMPlexMono-Text.woff","/ibm-plex-mono/IBMPlexMono-TextItalic.woff","/ibm-plex-mono/IBMPlexMono-SemiBold.woff","/ibm-plex-mono/IBMPlexMono-SemiBoldItalic.woff"],$=e=>`${q}${e}`,M=({includeNunitoSans:e=!1})=>k(P,{children:[i("link",{rel:"preconnect",href:v}),R.map(t=>i("link",{rel:"preload",href:$(t),as:"font",type:"font/woff",crossOrigin:"anonymous"},t)),e&&i(D,{})]});function D(){return k(P,{children:[i("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),i("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),i("link",{href:"https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap",rel:"stylesheet"})]})}import b from"clsx";import{createContext as F,useContext as C,useEffect as E,useMemo as x,useState as L}from"react";import N from"tiny-invariant";import{Fragment as O,jsx as g,jsxs as Q}from"react/jsx-runtime";var m="(prefers-color-scheme: dark)",l="(prefers-contrast: more)",H=["light","dark","light-high-contrast","dark-high-contrast"],w=["system",...H],Z=e=>e;function I(e){return typeof e!="string"?!1:w.includes(e)}var K=e=>e;function B(e){return typeof e!="string"?!1:H.includes(e)}var u="mantle-ui-theme";var y=F(null),f=()=>typeof window<"u";function d(e,t="system"){let n=t??"system";if(f()){let s=null;try{s="localStorage"in window?window.localStorage.getItem(e):null}catch{}return I(s)?s:n}return n}function j({children:e,defaultTheme:t="system",storageKey:n=u}){let[s,r]=L(()=>{let o=d(n,t);return c(o),o});E(()=>{let o=d(n,t);r(o),c(o)},[t,n]),E(()=>{let o=window.matchMedia(m),a=window.matchMedia(l),h=()=>{d(n,t)==="system"&&c("system")};return o.addEventListener("change",h),a.addEventListener("change",h),()=>{o.removeEventListener("change",h),a.removeEventListener("change",h)}},[t,n]);let p=x(()=>[s,o=>{try{"localStorage"in window&&window.localStorage.setItem(n,o)}catch{}r(o),c(o)}],[n,s]);return g(y.Provider,{value:p,children:e})}function ee(){let e=C(y);return N(e,"useTheme must be used within a ThemeProvider"),e}function c(e){if(!f())return;let t=window.document.documentElement;t.classList.remove(...w);let n=window.matchMedia(m).matches,s=window.matchMedia(l).matches,r=S(e,{prefersDarkMode:n,prefersHighContrast:s});t.classList.add(r),t.dataset.appliedTheme=r,t.dataset.theme=e}function te(){if(!f())return{appliedTheme:void 0,theme:void 0};let e=window.document.documentElement,t=I(e.dataset.theme)?e.dataset.theme:void 0;return{appliedTheme:B(e.dataset.appliedTheme)?e.dataset.appliedTheme:void 0,theme:t}}function S(e,{prefersDarkMode:t,prefersHighContrast:n}){return e==="system"?W({prefersDarkMode:t,prefersHighContrast:n}):e}function ne(){let e=C(y),t=e!=null?e[0]:"system",n=T(m),s=T(l);return S(t,{prefersDarkMode:n,prefersHighContrast:s})}function W({prefersDarkMode:e,prefersHighContrast:t}){return t?e?"dark-high-contrast":"light-high-contrast":e?"dark":"light"}function _({defaultTheme:e="system",storageKey:t=u}){return`
2
+ (function() {
3
+ const themes = ${JSON.stringify(w)};
4
+ const isTheme = (value) => typeof value === "string" && themes.includes(value);
5
+ const fallbackTheme = "${e}" ?? "system";
6
+ let maybeStoredTheme = null;
7
+ try {
8
+ maybeStoredTheme = "localStorage" in window ? window.localStorage.getItem("${t}") : null;
9
+ } catch (_) {}
10
+ const hasStoredTheme = isTheme(maybeStoredTheme);
11
+ if (!hasStoredTheme && "localStorage" in window) {
12
+ try {
13
+ window.localStorage.setItem("${t}", fallbackTheme);
14
+ } catch (_) {}
15
+ }
16
+ const themePreference = hasStoredTheme ? maybeStoredTheme : fallbackTheme;
17
+ const prefersDarkMode = window.matchMedia("${m}").matches;
18
+ const prefersHighContrast = window.matchMedia("${l}").matches;
19
+ let initialTheme = themePreference;
20
+ if (initialTheme === "system") {
21
+ if (prefersHighContrast) {
22
+ initialTheme = prefersDarkMode ? "dark-high-contrast" : "light-high-contrast";
23
+ } else {
24
+ initialTheme = prefersDarkMode ? "dark" : "light";
25
+ }
26
+ }
27
+ const htmlElement = document.documentElement;
28
+ htmlElement.classList.remove(...themes);
29
+ htmlElement.classList.add(initialTheme);
30
+ htmlElement.dataset.appliedTheme = initialTheme;
31
+ htmlElement.dataset.theme = themePreference;
32
+ })();
33
+ `.trim()}var oe=({defaultTheme:e="system",storageKey:t=u,includeNunitoSans:n=!1})=>Q(O,{children:[g("script",{dangerouslySetInnerHTML:{__html:_({defaultTheme:e,storageKey:t})}}),g(M,{includeNunitoSans:n})]});function se(e){let{className:t="",defaultTheme:n="system",storageKey:s=u}=e??{};return x(()=>{if(!f())return{className:b(t),"data-applied-theme":"system","data-theme":"system"};let r=window.matchMedia(m).matches,p=window.matchMedia(l).matches,o=d(s,n),a=S(o,{prefersDarkMode:r,prefersHighContrast:p});return{className:b(t,a),"data-applied-theme":a,"data-theme":o}},[t,n,s])}export{M as a,H as b,w as c,Z as d,I as e,K as f,B as g,j as h,ee as i,c as j,te as k,ne as l,_ as m,oe as n,se as o};
34
+ //# sourceMappingURL=chunk-273VK4KO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/theme-provider/preload-fonts.tsx","../src/components/theme-provider/theme-provider.tsx"],"sourcesContent":["const cdnOrigin = \"https://assets.ngrok.com\";\nconst cdnBase = `${cdnOrigin}/fonts`;\n\nconst fonts = [\n\t\"/euclid-square/EuclidSquare-Regular-WebS.woff\",\n\t\"/euclid-square/EuclidSquare-RegularItalic-WebS.woff\",\n\t\"/euclid-square/EuclidSquare-Medium-WebS.woff\",\n\t\"/euclid-square/EuclidSquare-Semibold-WebS.woff\",\n\t\"/euclid-square/EuclidSquare-MediumItalic-WebS.woff\",\n\t\"/ibm-plex-mono/IBMPlexMono-Text.woff\",\n\t\"/ibm-plex-mono/IBMPlexMono-TextItalic.woff\",\n\t\"/ibm-plex-mono/IBMPlexMono-SemiBold.woff\",\n\t\"/ibm-plex-mono/IBMPlexMono-SemiBoldItalic.woff\",\n] as const;\n\ntype Font = (typeof fonts)[number];\n\nconst fontHref = <T extends Font = Font>(font: T) => `${cdnBase}${font}` as const;\n\ntype Props = {\n\t/**\n\t * If set, will also preload and include the optional Nunito Sans font from Google Fonts.\n\t * @default false\n\t */\n\tincludeNunitoSans?: boolean;\n};\n\n/**\n * Preload custom fonts used in the theme. This should be added to the head of the document in your application, preferably as high as possible.\n * Normally you won't use this directly, but instead use the `MantleThemeHeadContent` component which includes this.\n */\nconst PreloadFonts = ({ includeNunitoSans = false }: Props) => (\n\t<>\n\t\t<link rel=\"preconnect\" href={cdnOrigin} />\n\t\t{fonts.map((font) => (\n\t\t\t<link key={font} rel=\"preload\" href={fontHref(font)} as=\"font\" type=\"font/woff\" crossOrigin=\"anonymous\" />\n\t\t))}\n\t\t{includeNunitoSans && <NunitoSans />}\n\t</>\n);\n\nexport {\n\t//,\n\tPreloadFonts,\n};\n\nfunction NunitoSans() {\n\treturn (\n\t\t<>\n\t\t\t<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\" />\n\t\t\t<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossOrigin=\"anonymous\" />\n\t\t\t<link\n\t\t\t\thref=\"https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap\"\n\t\t\t\trel=\"stylesheet\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n","import clsx from \"clsx\";\nimport type { ComponentProps, PropsWithChildren } from \"react\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { useMatchesMediaQuery } from \"../../hooks/use-matches-media-query.js\";\nimport { PreloadFonts } from \"./preload-fonts.js\";\n\n/**\n * prefersDarkModeMediaQuery is the media query used to detect if the user prefers dark mode.\n */\nconst prefersDarkModeMediaQuery = \"(prefers-color-scheme: dark)\";\n\n/**\n * prefersHighContrastMediaQuery is the media query used to detect if the user prefers high contrast mode.\n */\nconst prefersHighContrastMediaQuery = \"(prefers-contrast: more)\";\n\n/**\n * resolvedThemes is a tuple of valid themes that have been resolved from \"system\" to a specific theme.\n */\nconst resolvedThemes = [\"light\", \"dark\", \"light-high-contrast\", \"dark-high-contrast\"] as const;\n\n/**\n * ResolvedTheme is a type that represents a theme that has been resolved from \"system\" to a specific theme.\n */\ntype ResolvedTheme = (typeof resolvedThemes)[number];\n\n/**\n * themes is a tuple of valid themes.\n */\nconst themes = [\"system\", ...resolvedThemes] as const;\n\n/**\n * Theme is a string literal type that represents a valid theme.\n */\ntype Theme = (typeof themes)[number];\n\n/**\n * $theme is a helper which translates the Theme type into a string literal type.\n */\nconst $theme = <T extends Theme = Theme>(value: T) => value;\n\n/**\n * Type predicate that checks if a value is a valid theme.\n */\nfunction isTheme(value: unknown): value is Theme {\n\tif (typeof value !== \"string\") {\n\t\treturn false;\n\t}\n\n\treturn themes.includes(value as Theme);\n}\n\n/**\n * $resolvedTheme is a helper which translates the ResolvedTheme type into a string literal type.\n */\nconst $resolvedTheme = <T extends ResolvedTheme = ResolvedTheme>(value: T) => value;\n\n/**\n * Type predicate that checks if a value is a valid resolved theme.\n */\nfunction isResolvedTheme(value: unknown): value is ResolvedTheme {\n\tif (typeof value !== \"string\") {\n\t\treturn false;\n\t}\n\n\treturn resolvedThemes.includes(value as ResolvedTheme);\n}\n\n/**\n * DEFAULT_STORAGE_KEY is the default key used to store the theme in localStorage.\n */\nconst DEFAULT_STORAGE_KEY = \"mantle-ui-theme\";\n\n/**\n * ThemeProviderState is the shape of the state returned by the ThemeProviderContext.\n */\ntype ThemeProviderState = [theme: Theme, setTheme: (theme: Theme) => void];\n\n/**\n * Initial state for the ThemeProviderContext.\n */\nconst initialState: ThemeProviderState = [\"system\", () => null];\n\n/**\n * ThemeProviderContext is a React Context that provides the current theme and a function to set the theme.\n */\nconst ThemeProviderContext = createContext<ThemeProviderState | null>(null);\n\n/**\n * isBrowser returns true if the code is running in a browser environment.\n */\nconst isBrowser = () => typeof window !== \"undefined\";\n\n/**\n * Gets the stored theme from localStorage or returns the default theme if no theme is stored.\n */\nfunction getStoredTheme(storageKey: string, defaultTheme: Theme = \"system\") {\n\tconst fallbackTheme = defaultTheme ?? \"system\";\n\tif (isBrowser()) {\n\t\tlet storedTheme: string | null = null;\n\t\ttry {\n\t\t\tstoredTheme = \"localStorage\" in window ? window.localStorage.getItem(storageKey) : null;\n\t\t} catch (_) {}\n\t\treturn isTheme(storedTheme) ? storedTheme : fallbackTheme;\n\t}\n\treturn fallbackTheme;\n}\n\ntype ThemeProviderProps = PropsWithChildren & {\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n};\n\n/**\n * ThemeProvider is a React Context Provider that provides the current theme and a function to set the theme.\n */\nfunction ThemeProvider({ children, defaultTheme = \"system\", storageKey = DEFAULT_STORAGE_KEY }: ThemeProviderProps) {\n\tconst [theme, setTheme] = useState<Theme>(() => {\n\t\tconst initialTheme = getStoredTheme(storageKey, defaultTheme);\n\t\tapplyTheme(initialTheme);\n\t\treturn initialTheme;\n\t});\n\n\tuseEffect(() => {\n\t\tconst storedTheme = getStoredTheme(storageKey, defaultTheme);\n\t\tsetTheme(storedTheme);\n\t\tapplyTheme(storedTheme);\n\t}, [defaultTheme, storageKey]);\n\n\tuseEffect(() => {\n\t\tconst prefersDarkMql = window.matchMedia(prefersDarkModeMediaQuery);\n\t\tconst prefersHighContrastMql = window.matchMedia(prefersHighContrastMediaQuery);\n\n\t\tconst onChange = () => {\n\t\t\tconst storedTheme = getStoredTheme(storageKey, defaultTheme);\n\n\t\t\t// If the stored theme is not \"system\", then the user has explicitly set a theme and we should not\n\t\t\t// automatically change the theme when the user's system preferences change.\n\t\t\tif (storedTheme !== \"system\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tapplyTheme(\"system\");\n\t\t};\n\n\t\tprefersDarkMql.addEventListener(\"change\", onChange);\n\t\tprefersHighContrastMql.addEventListener(\"change\", onChange);\n\n\t\treturn () => {\n\t\t\tprefersDarkMql.removeEventListener(\"change\", onChange);\n\t\t\tprefersHighContrastMql.removeEventListener(\"change\", onChange);\n\t\t};\n\t}, [defaultTheme, storageKey]);\n\n\tconst value: ThemeProviderState = useMemo(\n\t\t() => [\n\t\t\ttheme,\n\t\t\t(theme: Theme) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (\"localStorage\" in window) {\n\t\t\t\t\t\twindow.localStorage.setItem(storageKey, theme);\n\t\t\t\t\t}\n\t\t\t\t} catch (_) {}\n\t\t\t\tsetTheme(theme);\n\t\t\t\tapplyTheme(theme);\n\t\t\t},\n\t\t],\n\t\t[storageKey, theme],\n\t);\n\n\treturn <ThemeProviderContext.Provider value={value}>{children}</ThemeProviderContext.Provider>;\n}\n\n/**\n * useTheme returns the current theme and a function to set the theme.\n *\n * @note This function will throw an error if used outside of a ThemeProvider context tree.\n */\nfunction useTheme() {\n\tconst context = useContext(ThemeProviderContext);\n\n\tinvariant(context, \"useTheme must be used within a ThemeProvider\");\n\n\treturn context;\n}\n\n/**\n * Applies the given theme to the `<html>` element.\n */\nfunction applyTheme(theme: Theme) {\n\tif (!isBrowser()) {\n\t\treturn;\n\t}\n\n\tconst htmlElement = window.document.documentElement;\n\thtmlElement.classList.remove(...themes);\n\tconst prefersDarkMode = window.matchMedia(prefersDarkModeMediaQuery).matches;\n\tconst prefersHighContrast = window.matchMedia(prefersHighContrastMediaQuery).matches;\n\tconst newTheme = resolveTheme(theme, { prefersDarkMode, prefersHighContrast });\n\thtmlElement.classList.add(newTheme);\n\thtmlElement.dataset.appliedTheme = newTheme;\n\thtmlElement.dataset.theme = theme;\n}\n\n/**\n * Read the theme and applied theme from the `<html>` element.\n */\nfunction readThemeFromHtmlElement() {\n\tif (!isBrowser()) {\n\t\treturn {\n\t\t\tappliedTheme: undefined,\n\t\t\ttheme: undefined,\n\t\t};\n\t}\n\n\tconst htmlElement = window.document.documentElement;\n\tconst theme = isTheme(htmlElement.dataset.theme) ? htmlElement.dataset.theme : undefined;\n\tconst appliedTheme = isResolvedTheme(htmlElement.dataset.appliedTheme) ? htmlElement.dataset.appliedTheme : undefined;\n\n\treturn {\n\t\tappliedTheme,\n\t\ttheme,\n\t};\n}\n\n/**\n * If the theme is \"system\", it will resolve the theme based on the user's media query preferences, otherwise it will return the theme as is.\n * This will mirror the result that gets applied to the <html> element.\n */\nfunction resolveTheme(\n\ttheme: Theme,\n\t{ prefersDarkMode, prefersHighContrast }: { prefersDarkMode: boolean; prefersHighContrast: boolean },\n) {\n\tif (theme === \"system\") {\n\t\treturn determineThemeFromMediaQuery({ prefersDarkMode, prefersHighContrast });\n\t}\n\n\treturn theme;\n}\n\n/**\n * If the theme is \"system\", it will resolve the theme based on the user's media query preferences, otherwise it will return the theme as is.\n * This will mirror the result that gets applied to the <html> element.\n */\nfunction useAppliedTheme() {\n\tconst themeContext = useContext(ThemeProviderContext);\n\tconst theme = themeContext != null ? themeContext[0] : \"system\";\n\n\tconst prefersDarkMode = useMatchesMediaQuery(prefersDarkModeMediaQuery);\n\tconst prefersHighContrast = useMatchesMediaQuery(prefersHighContrastMediaQuery);\n\n\treturn resolveTheme(theme, { prefersDarkMode, prefersHighContrast });\n}\n\n/**\n * determineThemeFromMediaQuery returns the theme that should be used based on the user's media query preferences.\n * @private\n */\nexport function determineThemeFromMediaQuery({\n\tprefersDarkMode,\n\tprefersHighContrast,\n}: {\n\tprefersDarkMode: boolean;\n\tprefersHighContrast: boolean;\n}): ResolvedTheme {\n\tif (prefersHighContrast) {\n\t\treturn prefersDarkMode ? \"dark-high-contrast\" : \"light-high-contrast\";\n\t}\n\n\treturn prefersDarkMode ? \"dark\" : \"light\";\n}\n\nfunction preventWrongThemeFlashScriptContent({\n\tdefaultTheme = \"system\",\n\tstorageKey = DEFAULT_STORAGE_KEY,\n}: {\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n}) {\n\treturn `\n(function() {\n\tconst themes = ${JSON.stringify(themes)};\n\tconst isTheme = (value) => typeof value === \"string\" && themes.includes(value);\n\tconst fallbackTheme = \"${defaultTheme}\" ?? \"system\";\n\tlet maybeStoredTheme = null;\n\ttry {\n\t\tmaybeStoredTheme = \"localStorage\" in window ? window.localStorage.getItem(\"${storageKey}\") : null;\n\t} catch (_) {}\n\tconst hasStoredTheme = isTheme(maybeStoredTheme);\n\tif (!hasStoredTheme && \"localStorage\" in window) {\n\t\ttry {\n\t\t\twindow.localStorage.setItem(\"${storageKey}\", fallbackTheme);\n\t\t} catch (_) {}\n\t}\n\tconst themePreference = hasStoredTheme ? maybeStoredTheme : fallbackTheme;\n\tconst prefersDarkMode = window.matchMedia(\"${prefersDarkModeMediaQuery}\").matches;\n\tconst prefersHighContrast = window.matchMedia(\"${prefersHighContrastMediaQuery}\").matches;\n\tlet initialTheme = themePreference;\n\tif (initialTheme === \"system\") {\n\t\tif (prefersHighContrast) {\n\t\t\tinitialTheme = prefersDarkMode ? \"dark-high-contrast\" : \"light-high-contrast\";\n\t\t} else {\n\t\t\tinitialTheme = prefersDarkMode ? \"dark\" : \"light\";\n\t\t}\n\t}\n\tconst htmlElement = document.documentElement;\n\thtmlElement.classList.remove(...themes);\n\thtmlElement.classList.add(initialTheme);\n\thtmlElement.dataset.appliedTheme = initialTheme;\n\thtmlElement.dataset.theme = themePreference;\n})();\n`.trim();\n}\n\ntype MantleThemeHeadContentProps = {\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n} & ComponentProps<typeof PreloadFonts>;\n\n/**\n * MantleThemeHeadContent is a React component that prevents the wrong theme from flashing on initial page load.\n * Render as high as possible in the <head> element.\n */\nconst MantleThemeHeadContent = ({\n\tdefaultTheme = \"system\",\n\tstorageKey = DEFAULT_STORAGE_KEY,\n\tincludeNunitoSans = false,\n}: MantleThemeHeadContentProps) => (\n\t<>\n\t\t<script\n\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t__html: preventWrongThemeFlashScriptContent({ defaultTheme, storageKey }),\n\t\t\t}}\n\t\t/>\n\t\t<PreloadFonts includeNunitoSans={includeNunitoSans} />\n\t</>\n);\n\ntype InitialThemeProps = {\n\tclassName: string;\n\t\"data-applied-theme\": Omit<Theme, \"system\">;\n\t\"data-theme\": Theme;\n};\n\n/**\n * useInitialHtmlThemeProps returns the initial props that should be applied to the <html> element to prevent react hydration errors.\n */\nfunction useInitialHtmlThemeProps(props?: {\n\tclassName?: string;\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n}): InitialThemeProps {\n\tconst { className = \"\", defaultTheme = \"system\", storageKey = DEFAULT_STORAGE_KEY } = props ?? {};\n\n\treturn useMemo(() => {\n\t\tif (!isBrowser()) {\n\t\t\treturn {\n\t\t\t\tclassName: clsx(className),\n\t\t\t\t\"data-applied-theme\": \"system\",\n\t\t\t\t\"data-theme\": \"system\",\n\t\t\t};\n\t\t}\n\n\t\tconst prefersDarkMode = window.matchMedia(prefersDarkModeMediaQuery).matches;\n\t\tconst prefersHighContrast = window.matchMedia(prefersHighContrastMediaQuery).matches;\n\t\tconst initialTheme = getStoredTheme(storageKey, defaultTheme);\n\t\tconst reolvedTheme = resolveTheme(initialTheme, { prefersDarkMode, prefersHighContrast });\n\n\t\treturn {\n\t\t\tclassName: clsx(className, reolvedTheme),\n\t\t\t\"data-applied-theme\": reolvedTheme,\n\t\t\t\"data-theme\": initialTheme,\n\t\t};\n\t}, [className, defaultTheme, storageKey]);\n}\n\nexport {\n\t//,\n\t$resolvedTheme,\n\t$theme,\n\tapplyTheme,\n\tisResolvedTheme,\n\tisTheme,\n\tMantleThemeHeadContent,\n\tpreventWrongThemeFlashScriptContent,\n\treadThemeFromHtmlElement,\n\tresolvedThemes,\n\tThemeProvider,\n\tthemes,\n\tuseAppliedTheme,\n\tuseInitialHtmlThemeProps,\n\tuseTheme,\n};\n\nexport type {\n\t//,\n\tResolvedTheme,\n\tTheme,\n\tThemeProviderProps,\n};\n"],"mappings":"wCAgCC,mBAAAA,EACC,OAAAC,EADD,QAAAC,MAAA,oBAhCD,IAAMC,EAAY,2BACZC,EAAU,GAAGD,CAAS,SAEtBE,EAAQ,CACb,gDACA,sDACA,+CACA,iDACA,qDACA,uCACA,6CACA,2CACA,gDACD,EAIMC,EAAmCC,GAAY,GAAGH,CAAO,GAAGG,CAAI,GAchEC,EAAe,CAAC,CAAE,kBAAAC,EAAoB,EAAM,IACjDP,EAAAF,EAAA,CACC,UAAAC,EAAC,QAAK,IAAI,aAAa,KAAME,EAAW,EACv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","jsxs","cdnOrigin","cdnBase","fonts","fontHref","font","PreloadFonts","includeNunitoSans","NunitoSans","NunitoSans","jsxs","Fragment","jsx","clsx","createContext","useContext","useEffect","useMemo","useState","invariant","Fragment","jsx","jsxs","prefersDarkModeMediaQuery","prefersHighContrastMediaQuery","resolvedThemes","themes","$theme","value","isTheme","$resolvedTheme","isResolvedTheme","DEFAULT_STORAGE_KEY","ThemeProviderContext","createContext","isBrowser","getStoredTheme","storageKey","defaultTheme","fallbackTheme","storedTheme","isTheme","ThemeProvider","children","DEFAULT_STORAGE_KEY","theme","setTheme","useState","initialTheme","applyTheme","useEffect","prefersDarkMql","prefersDarkModeMediaQuery","prefersHighContrastMql","prefersHighContrastMediaQuery","onChange","value","useMemo","jsx","useTheme","context","useContext","invariant","htmlElement","themes","prefersDarkMode","prefersHighContrast","newTheme","resolveTheme","readThemeFromHtmlElement","isResolvedTheme","determineThemeFromMediaQuery","useAppliedTheme","themeContext","useMatchesMediaQuery","preventWrongThemeFlashScriptContent","MantleThemeHeadContent","includeNunitoSans","jsxs","Fragment","PreloadFonts","useInitialHtmlThemeProps","props","className","clsx","reolvedTheme"]}
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-RDMTCZPT.js";import{a as o}from"./chunk-SMCZZUU4.js";import{a as d}from"./chunk-EW5CFGXT.js";import{CircleNotch as V}from"@phosphor-icons/react/CircleNotch";import{Slot as z}from"@radix-ui/react-slot";import{cva as C}from"class-variance-authority";import{Children as H,cloneElement as I,forwardRef as M,isValidElement as T}from"react";import{jsx as t,jsxs as A}from"react/jsx-runtime";var E=C("inline-flex shrink-0 cursor-pointer items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] border focus-within:outline-none focus-visible:ring-4 disabled:cursor-default disabled:opacity-50",{variants:{appearance:{ghost:"text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong not-disabled:active:bg-neutral-500/15 not-disabled:active:text-strong border-transparent",outlined:"border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong not-disabled:active:border-neutral-400 not-disabled:active:bg-neutral-500/10 not-disabled:active:text-strong focus-visible:not-disabled:active:border-accent-600"},isLoading:{false:"",true:"opacity-50"},size:{xs:"size-7 sm:size-6",sm:"size-9 sm:size-7",md:"size-11 sm:size-9"}},defaultVariants:{appearance:"outlined",size:"md"}}),N=M(({"aria-disabled":c,appearance:u,asChild:b=!1,children:p,className:m,disabled:f,icon:v,isLoading:e=!1,label:h,size:n,type:g,...y},B)=>{let i=l(c??f??e),r=e?t(V,{className:"animate-spin"}):v,s={"aria-disabled":i,className:d("icon-button",E({appearance:u,isLoading:e,size:n}),m),"data-loading":e,"data-size":n,disabled:i,ref:B,...y};if(b){let a=H.only(p),x=T(a);return t(z,{...s,children:x&&I(a,{},t(o,{svg:r}))})}return A("button",{...s,type:g,children:[t("span",{className:"sr-only",children:h}),t(o,{svg:r})]})});N.displayName="IconButton";export{N as a};
2
- //# sourceMappingURL=chunk-7AUDKKSM.js.map
1
+ import{a as l}from"./chunk-RDMTCZPT.js";import{a as o}from"./chunk-SMCZZUU4.js";import{a as d}from"./chunk-EW5CFGXT.js";import{CircleNotch as V}from"@phosphor-icons/react/CircleNotch";import{Slot as z}from"@radix-ui/react-slot";import{cva as C}from"class-variance-authority";import{Children as H,cloneElement as I,forwardRef as M,isValidElement as T}from"react";import{jsx as t,jsxs as A}from"react/jsx-runtime";var E=C("inline-flex shrink-0 cursor-pointer items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] border focus-within:outline-none focus-visible:ring-4 disabled:cursor-default disabled:opacity-50",{variants:{appearance:{ghost:"text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong not-disabled:active:bg-neutral-500/15 not-disabled:active:text-strong border-transparent",outlined:"border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong not-disabled:active:border-neutral-400 not-disabled:active:bg-neutral-500/10 not-disabled:active:text-strong focus-visible:not-disabled:active:border-accent-600"},isLoading:{false:"",true:"opacity-50"},size:{xs:"size-7 sm:size-6",sm:"size-9 sm:size-7",md:"size-11 sm:size-9"}},defaultVariants:{appearance:"outlined",size:"md"}}),N=M(({"aria-disabled":c,appearance:u,asChild:b=!1,children:p,className:m,disabled:f,icon:v,isLoading:e=!1,label:h,size:n,type:g,...y},B)=>{let i=l(c??f??e),r=e?t(V,{className:"animate-spin"}):v,s={"aria-disabled":i,"data-icon-button":!0,"data-loading":e,"data-size":n,className:d("icon-button",E({appearance:u,isLoading:e,size:n}),m),disabled:i,ref:B,...y};if(b){let a=H.only(p),x=T(a);return t(z,{...s,children:x&&I(a,{},t(o,{svg:r}))})}return A("button",{...s,type:g,children:[t("span",{className:"sr-only",children:h}),t(o,{svg:r})]})});N.displayName="IconButton";export{N as a};
2
+ //# sourceMappingURL=chunk-BU7JVIWF.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/button/icon-button.tsx"],"sourcesContent":["import { CircleNotch } from \"@phosphor-icons/react/CircleNotch\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva } from \"class-variance-authority\";\nimport { Children, cloneElement, forwardRef, isValidElement } from \"react\";\nimport type { ButtonHTMLAttributes, ReactNode } from \"react\";\nimport type { VariantProps, WithAsChild } from \"../../types/index.js\";\nimport { parseBooleanish } from \"../../types/index.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon } from \"../icon/index.js\";\n\nconst iconButtonVariants = cva(\n\t\"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] border focus-within:outline-none focus-visible:ring-4 disabled:cursor-default disabled:opacity-50\",\n\t{\n\t\tvariants: {\n\t\t\t/**\n\t\t\t * Defines the visual style of the Button.\n\t\t\t */\n\t\t\tappearance: {\n\t\t\t\tghost:\n\t\t\t\t\t\"text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong not-disabled:active:bg-neutral-500/15 not-disabled:active:text-strong border-transparent\",\n\t\t\t\toutlined:\n\t\t\t\t\t\"border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong not-disabled:active:border-neutral-400 not-disabled:active:bg-neutral-500/10 not-disabled:active:text-strong focus-visible:not-disabled:active:border-accent-600\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * Whether or not the button is in a loading state, default `false`. Setting `isLoading` will\n\t\t\t * replace the `icon` with a spinner.\n\t\t\t * It will also disable user interaction with the button and set `aria-disabled`.\n\t\t\t */\n\t\t\tisLoading: {\n\t\t\t\tfalse: \"\",\n\t\t\t\ttrue: \"opacity-50\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * The size of the IconButton.\n\t\t\t */\n\t\t\tsize: {\n\t\t\t\txs: \"size-7 sm:size-6\",\n\t\t\t\tsm: \"size-9 sm:size-7\",\n\t\t\t\tmd: \"size-11 sm:size-9\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tappearance: \"outlined\",\n\t\t\tsize: \"md\",\n\t\t},\n\t},\n);\n\ntype IconButtonVariants = VariantProps<typeof iconButtonVariants>;\n\n/**\n * The props for the `Button` component.\n */\ntype IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n\tWithAsChild &\n\tIconButtonVariants & {\n\t\t/**\n\t\t * The accessible label for the icon. This label will be visually hidden but announced to screen reader users, similar to alt text for img tags.\n\t\t */\n\t\tlabel: string;\n\t\t/**\n\t\t * An icon to render inside the button. If the `state` is `\"pending\"`, then\n\t\t * the icon will automatically be replaced with a spinner.\n\t\t */\n\t\ticon: ReactNode;\n\t} & (\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * Use the `asChild` prop to compose Radix's functionality onto alternative\n\t\t\t\t * element types or your own React components.\n\t\t\t\t *\n\t\t\t\t * When `asChild` is set to `true`, mantle will not render a default DOM\n\t\t\t\t * element, instead cloning the component's child and passing it the props and\n\t\t\t\t * behavior required to make it functional.\n\t\t\t\t *\n\t\t\t\t * asChild can be used as deeply as you need to. This means it is a great way\n\t\t\t\t * to compose multiple primitive's behavior together.\n\t\t\t\t *\n\t\t\t\t * @see https://www.radix-ui.com/docs/primitives/guides/composition#composition\n\t\t\t\t */\n\t\t\t\tasChild: true;\n\t\t\t\t/**\n\t\t\t\t * The default behavior of the button. Possible values are: `\"button\"`, `\"submit\"`, and `\"reset\"`.\n\t\t\t\t *\n\t\t\t\t * if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.\n\t\t\t\t *\n\t\t\t\t * If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type\n\t\t\t\t *\n\t\t\t\t * @enum\n\t\t\t\t * - `\"button\"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.\n\t\t\t\t * - `\"reset\"`: The button resets all the controls to their initial values.\n\t\t\t\t * - `\"submit\"`: The button submits the form data to the server.\n\t\t\t\t *\n\t\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type\n\t\t\t\t */\n\t\t\t\ttype?: ButtonHTMLAttributes<HTMLButtonElement>[\"type\"];\n\t\t }\n\t\t| {\n\t\t\t\tasChild?: false | undefined;\n\t\t\t\t/**\n\t\t\t\t * The default behavior of the button. Possible values are: `\"button\"`, `\"submit\"`, and `\"reset\"`.\n\t\t\t\t *\n\t\t\t\t * if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.\n\t\t\t\t *\n\t\t\t\t * If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type\n\t\t\t\t *\n\t\t\t\t * @enum\n\t\t\t\t * - `\"button\"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.\n\t\t\t\t * - `\"reset\"`: The button resets all the controls to their initial values.\n\t\t\t\t * - `\"submit\"`: The button submits the form data to the server.\n\t\t\t\t *\n\t\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type\n\t\t\t\t */\n\t\t\t\ttype: Exclude<ButtonHTMLAttributes<HTMLButtonElement>[\"type\"], undefined>;\n\t\t }\n\t);\n\n/**\n * Renders a button or a component that looks like a button, an interactive\n * element activated by a user with a mouse, keyboard, finger, voice command, or\n * other assistive technology. Once activated, it then performs an action, such\n * as submitting a form or opening a dialog.\n * Renders only a single icon as children with an accessible, screen-reader-only label.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button\n */\nconst IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n\t(\n\t\t{\n\t\t\t\"aria-disabled\": _ariaDisabled,\n\t\t\tappearance,\n\t\t\tasChild = false,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tdisabled: _disabled,\n\t\t\ticon: propIcon,\n\t\t\tisLoading = false,\n\t\t\tlabel,\n\t\t\tsize,\n\t\t\ttype,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst disabled = parseBooleanish(_ariaDisabled ?? _disabled ?? isLoading);\n\t\tconst icon = isLoading ? <CircleNotch className=\"animate-spin\" /> : propIcon;\n\n\t\tconst buttonProps = {\n\t\t\t\"aria-disabled\": disabled,\n\t\t\tclassName: cx(\"icon-button\", iconButtonVariants({ appearance, isLoading, size }), className),\n\t\t\t\"data-loading\": isLoading,\n\t\t\t\"data-size\": size,\n\t\t\tdisabled,\n\t\t\tref,\n\t\t\t...props,\n\t\t};\n\n\t\tif (asChild) {\n\t\t\tconst singleChild = Children.only(children);\n\t\t\tconst isValidChild = isValidElement(singleChild);\n\n\t\t\treturn <Slot {...buttonProps}>{isValidChild && cloneElement(singleChild, {}, <Icon svg={icon} />)}</Slot>;\n\t\t}\n\n\t\treturn (\n\t\t\t<button {...buttonProps} type={type}>\n\t\t\t\t<span className=\"sr-only\">{label}</span>\n\t\t\t\t<Icon svg={icon} />\n\t\t\t</button>\n\t\t);\n\t},\n);\nIconButton.displayName = \"IconButton\";\n\nexport { IconButton, iconButtonVariants };\nexport type { IconButtonProps };\n"],"mappings":"wHAAA,OAAS,eAAAA,MAAmB,oCAC5B,OAAS,QAAAC,MAAY,uBACrB,OAAS,OAAAC,MAAW,2BACpB,OAAS,YAAAC,EAAU,gBAAAC,EAAc,cAAAC,EAAY,kBAAAC,MAAsB,QA8IxC,cAAAC,EAoBxB,QAAAC,MApBwB,oBAvI3B,IAAMC,EAAqBC,EAC1B,wNACA,CACC,SAAU,CAIT,WAAY,CACX,MACC,2MACD,SACC,wWACF,EAMA,UAAW,CACV,MAAO,GACP,KAAM,YACP,EAIA,KAAM,CACL,GAAI,mBACJ,GAAI,mBACJ,GAAI,mBACL,CACD,EACA,gBAAiB,CAChB,WAAY,WACZ,KAAM,IACP,CACD,CACD,EAgFMC,EAAaC,EAClB,CACC,CACC,gBAAiBC,EACjB,WAAAC,EACA,QAAAC,EAAU,GACV,SAAAC,EACA,UAAAC,EACA,SAAUC,EACV,KAAMC,EACN,UAAAC,EAAY,GACZ,MAAAC,EACA,KAAAC,EACA,KAAAC,EACA,GAAGC,CACJ,EACAC,IACI,CACJ,IAAMC,EAAWC,EAAgBd,GAAiBK,GAAaE,CAAS,EAClEQ,EAAOR,EAAYb,EAACsB,EAAA,CAAY,UAAU,eAAe,EAAKV,EAE9DW,EAAc,CACnB,gBAAiBJ,EACjB,UAAWK,EAAG,cAAetB,EAAmB,CAAE,WAAAK,EAAY,UAAAM,EAAW,KAAAE,CAAK,CAAC,EAAGL,CAAS,EAC3F,eAAgBG,EAChB,YAAaE,EACb,SAAAI,EACA,IAAAD,EACA,GAAGD,CACJ,EAEA,GAAIT,EAAS,CACZ,IAAMiB,EAAcC,EAAS,KAAKjB,CAAQ,EACpCkB,EAAeC,EAAeH,CAAW,EAE/C,OAAOzB,EAAC6B,EAAA,CAAM,GAAGN,EAAc,SAAAI,GAAgBG,EAAaL,EAAa,CAAC,EAAGzB,EAAC+B,EAAA,CAAK,IAAKV,EAAM,CAAE,EAAE,CACnG,CAEA,OACCpB,EAAC,UAAQ,GAAGsB,EAAa,KAAMP,EAC9B,UAAAhB,EAAC,QAAK,UAAU,UAAW,SAAAc,EAAM,EACjCd,EAAC+B,EAAA,CAAK,IAAKV,EAAM,GAClB,CAEF,CACD,EACAjB,EAAW,YAAc","names":["CircleNotch","Slot","cva","Children","cloneElement","forwardRef","isValidElement","jsx","jsxs","iconButtonVariants","cva","IconButton","forwardRef","_ariaDisabled","appearance","asChild","children","className","_disabled","propIcon","isLoading","label","size","type","props","ref","disabled","parseBooleanish","icon","CircleNotch","buttonProps","cx","singleChild","Children","isValidChild","isValidElement","Slot","cloneElement","Icon"]}
1
+ {"version":3,"sources":["../src/components/button/icon-button.tsx"],"sourcesContent":["import { CircleNotch } from \"@phosphor-icons/react/CircleNotch\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva } from \"class-variance-authority\";\nimport { Children, cloneElement, forwardRef, isValidElement } from \"react\";\nimport type { ButtonHTMLAttributes, ReactNode } from \"react\";\nimport type { VariantProps, WithAsChild } from \"../../types/index.js\";\nimport { parseBooleanish } from \"../../types/index.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon } from \"../icon/index.js\";\n\nconst iconButtonVariants = cva(\n\t\"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] border focus-within:outline-none focus-visible:ring-4 disabled:cursor-default disabled:opacity-50\",\n\t{\n\t\tvariants: {\n\t\t\t/**\n\t\t\t * Defines the visual style of the Button.\n\t\t\t */\n\t\t\tappearance: {\n\t\t\t\tghost:\n\t\t\t\t\t\"text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong not-disabled:active:bg-neutral-500/15 not-disabled:active:text-strong border-transparent\",\n\t\t\t\toutlined:\n\t\t\t\t\t\"border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong not-disabled:active:border-neutral-400 not-disabled:active:bg-neutral-500/10 not-disabled:active:text-strong focus-visible:not-disabled:active:border-accent-600\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * Whether or not the button is in a loading state, default `false`. Setting `isLoading` will\n\t\t\t * replace the `icon` with a spinner.\n\t\t\t * It will also disable user interaction with the button and set `aria-disabled`.\n\t\t\t */\n\t\t\tisLoading: {\n\t\t\t\tfalse: \"\",\n\t\t\t\ttrue: \"opacity-50\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * The size of the IconButton.\n\t\t\t */\n\t\t\tsize: {\n\t\t\t\txs: \"size-7 sm:size-6\",\n\t\t\t\tsm: \"size-9 sm:size-7\",\n\t\t\t\tmd: \"size-11 sm:size-9\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tappearance: \"outlined\",\n\t\t\tsize: \"md\",\n\t\t},\n\t},\n);\n\ntype IconButtonVariants = VariantProps<typeof iconButtonVariants>;\n\n/**\n * The props for the `Button` component.\n */\ntype IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n\tWithAsChild &\n\tIconButtonVariants & {\n\t\t/**\n\t\t * The accessible label for the icon. This label will be visually hidden but announced to screen reader users, similar to alt text for img tags.\n\t\t */\n\t\tlabel: string;\n\t\t/**\n\t\t * An icon to render inside the button. If the `state` is `\"pending\"`, then\n\t\t * the icon will automatically be replaced with a spinner.\n\t\t */\n\t\ticon: ReactNode;\n\t} & (\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * Use the `asChild` prop to compose Radix's functionality onto alternative\n\t\t\t\t * element types or your own React components.\n\t\t\t\t *\n\t\t\t\t * When `asChild` is set to `true`, mantle will not render a default DOM\n\t\t\t\t * element, instead cloning the component's child and passing it the props and\n\t\t\t\t * behavior required to make it functional.\n\t\t\t\t *\n\t\t\t\t * asChild can be used as deeply as you need to. This means it is a great way\n\t\t\t\t * to compose multiple primitive's behavior together.\n\t\t\t\t *\n\t\t\t\t * @see https://www.radix-ui.com/docs/primitives/guides/composition#composition\n\t\t\t\t */\n\t\t\t\tasChild: true;\n\t\t\t\t/**\n\t\t\t\t * The default behavior of the button. Possible values are: `\"button\"`, `\"submit\"`, and `\"reset\"`.\n\t\t\t\t *\n\t\t\t\t * if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.\n\t\t\t\t *\n\t\t\t\t * If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type\n\t\t\t\t *\n\t\t\t\t * @enum\n\t\t\t\t * - `\"button\"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.\n\t\t\t\t * - `\"reset\"`: The button resets all the controls to their initial values.\n\t\t\t\t * - `\"submit\"`: The button submits the form data to the server.\n\t\t\t\t *\n\t\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type\n\t\t\t\t */\n\t\t\t\ttype?: ButtonHTMLAttributes<HTMLButtonElement>[\"type\"];\n\t\t }\n\t\t| {\n\t\t\t\tasChild?: false | undefined;\n\t\t\t\t/**\n\t\t\t\t * The default behavior of the button. Possible values are: `\"button\"`, `\"submit\"`, and `\"reset\"`.\n\t\t\t\t *\n\t\t\t\t * if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.\n\t\t\t\t *\n\t\t\t\t * If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type\n\t\t\t\t *\n\t\t\t\t * @enum\n\t\t\t\t * - `\"button\"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.\n\t\t\t\t * - `\"reset\"`: The button resets all the controls to their initial values.\n\t\t\t\t * - `\"submit\"`: The button submits the form data to the server.\n\t\t\t\t *\n\t\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type\n\t\t\t\t */\n\t\t\t\ttype: Exclude<ButtonHTMLAttributes<HTMLButtonElement>[\"type\"], undefined>;\n\t\t }\n\t);\n\n/**\n * Renders a button or a component that looks like a button, an interactive\n * element activated by a user with a mouse, keyboard, finger, voice command, or\n * other assistive technology. Once activated, it then performs an action, such\n * as submitting a form or opening a dialog.\n * Renders only a single icon as children with an accessible, screen-reader-only label.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button\n */\nconst IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n\t(\n\t\t{\n\t\t\t\"aria-disabled\": _ariaDisabled,\n\t\t\tappearance,\n\t\t\tasChild = false,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tdisabled: _disabled,\n\t\t\ticon: propIcon,\n\t\t\tisLoading = false,\n\t\t\tlabel,\n\t\t\tsize,\n\t\t\ttype,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst disabled = parseBooleanish(_ariaDisabled ?? _disabled ?? isLoading);\n\t\tconst icon = isLoading ? <CircleNotch className=\"animate-spin\" /> : propIcon;\n\n\t\tconst buttonProps = {\n\t\t\t\"aria-disabled\": disabled,\n\t\t\t\"data-icon-button\": true,\n\t\t\t\"data-loading\": isLoading,\n\t\t\t\"data-size\": size,\n\t\t\tclassName: cx(\"icon-button\", iconButtonVariants({ appearance, isLoading, size }), className),\n\t\t\tdisabled,\n\t\t\tref,\n\t\t\t...props,\n\t\t};\n\n\t\tif (asChild) {\n\t\t\tconst singleChild = Children.only(children);\n\t\t\tconst isValidChild = isValidElement(singleChild);\n\n\t\t\treturn <Slot {...buttonProps}>{isValidChild && cloneElement(singleChild, {}, <Icon svg={icon} />)}</Slot>;\n\t\t}\n\n\t\treturn (\n\t\t\t<button {...buttonProps} type={type}>\n\t\t\t\t<span className=\"sr-only\">{label}</span>\n\t\t\t\t<Icon svg={icon} />\n\t\t\t</button>\n\t\t);\n\t},\n);\nIconButton.displayName = \"IconButton\";\n\nexport { IconButton, iconButtonVariants };\nexport type { IconButtonProps };\n"],"mappings":"wHAAA,OAAS,eAAAA,MAAmB,oCAC5B,OAAS,QAAAC,MAAY,uBACrB,OAAS,OAAAC,MAAW,2BACpB,OAAS,YAAAC,EAAU,gBAAAC,EAAc,cAAAC,EAAY,kBAAAC,MAAsB,QA8IxC,cAAAC,EAqBxB,QAAAC,MArBwB,oBAvI3B,IAAMC,EAAqBC,EAC1B,wNACA,CACC,SAAU,CAIT,WAAY,CACX,MACC,2MACD,SACC,wWACF,EAMA,UAAW,CACV,MAAO,GACP,KAAM,YACP,EAIA,KAAM,CACL,GAAI,mBACJ,GAAI,mBACJ,GAAI,mBACL,CACD,EACA,gBAAiB,CAChB,WAAY,WACZ,KAAM,IACP,CACD,CACD,EAgFMC,EAAaC,EAClB,CACC,CACC,gBAAiBC,EACjB,WAAAC,EACA,QAAAC,EAAU,GACV,SAAAC,EACA,UAAAC,EACA,SAAUC,EACV,KAAMC,EACN,UAAAC,EAAY,GACZ,MAAAC,EACA,KAAAC,EACA,KAAAC,EACA,GAAGC,CACJ,EACAC,IACI,CACJ,IAAMC,EAAWC,EAAgBd,GAAiBK,GAAaE,CAAS,EAClEQ,EAAOR,EAAYb,EAACsB,EAAA,CAAY,UAAU,eAAe,EAAKV,EAE9DW,EAAc,CACnB,gBAAiBJ,EACjB,mBAAoB,GACpB,eAAgBN,EAChB,YAAaE,EACb,UAAWS,EAAG,cAAetB,EAAmB,CAAE,WAAAK,EAAY,UAAAM,EAAW,KAAAE,CAAK,CAAC,EAAGL,CAAS,EAC3F,SAAAS,EACA,IAAAD,EACA,GAAGD,CACJ,EAEA,GAAIT,EAAS,CACZ,IAAMiB,EAAcC,EAAS,KAAKjB,CAAQ,EACpCkB,EAAeC,EAAeH,CAAW,EAE/C,OAAOzB,EAAC6B,EAAA,CAAM,GAAGN,EAAc,SAAAI,GAAgBG,EAAaL,EAAa,CAAC,EAAGzB,EAAC+B,EAAA,CAAK,IAAKV,EAAM,CAAE,EAAE,CACnG,CAEA,OACCpB,EAAC,UAAQ,GAAGsB,EAAa,KAAMP,EAC9B,UAAAhB,EAAC,QAAK,UAAU,UAAW,SAAAc,EAAM,EACjCd,EAAC+B,EAAA,CAAK,IAAKV,EAAM,GAClB,CAEF,CACD,EACAjB,EAAW,YAAc","names":["CircleNotch","Slot","cva","Children","cloneElement","forwardRef","isValidElement","jsx","jsxs","iconButtonVariants","cva","IconButton","forwardRef","_ariaDisabled","appearance","asChild","children","className","_disabled","propIcon","isLoading","label","size","type","props","ref","disabled","parseBooleanish","icon","CircleNotch","buttonProps","cx","singleChild","Children","isValidChild","isValidElement","Slot","cloneElement","Icon"]}
@@ -0,0 +1,2 @@
1
+ import{l as P}from"./chunk-273VK4KO.js";import{a as p}from"./chunk-SMCZZUU4.js";import{a as i}from"./chunk-EW5CFGXT.js";import{CheckCircle as h}from"@phosphor-icons/react/CheckCircle";import{Info as v}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 l}from"@radix-ui/react-slot";import{createContext as f,forwardRef as d,useContext as y}from"react";import*as m from"sonner";import{jsx as r,jsxs as A}from"react/jsx-runtime";var B=({className:t,containerAriaLabel:e,dir:o,duration_ms:s=4e3,position:n="top-center",style:a})=>{let c=P();return r(m.Toaster,{className:i("toaster mantle-prompt pointer-events-auto font-sans *:duration-200",t),containerAriaLabel:e,dir:o,duration:s,gap:12,position:n??"top-center",style:a,theme:c,toastOptions:{unstyled:!0}})},g=f("");function _(t,e){return m.toast.custom(o=>r(g.Provider,{value:e?.id??o,children:t}),{duration:e?.duration_ms,id:e?.id,unstyled:!0})}var T=f({priority:"info"}),j=d(({asChild:t,children:e,className:o,priority:s,...n},a)=>{let c=t?l:"div";return r(T.Provider,{value:{priority:s},children:A(c,{className:i("relative flex items-start gap-2 text-base sm: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",o),ref:a,...n,children:[r(w,{priority:s}),e]})})}),D=d(({className:t,svg:e,...o},s)=>{let n=y(T);switch(n.priority){case"danger":return r(p,{className:i("text-danger-600",t),ref:s,svg:e??r(C,{weight:"fill"}),...o});case"warning":return r(p,{className:i("text-warning-600",t),ref:s,svg:e??r(b,{weight:"fill"}),...o});case"success":return r(p,{className:i("text-success-600",t),ref:s,svg:e??r(h,{weight:"fill"}),...o});case"info":return r(p,{className:i("text-accent-600",t),ref:s,svg:r(v,{weight:"fill"}),...o});default:throw new Error(`Unreachable Case: ${n.priority}`)}}),L=d(({asChild:t,className:e,onClick:o,...s},n)=>{let a=y(g);return r(t?l:"button",{className:i("shrink-0","data-[icon-button]:-mr-0.5 data-[icon-button]:-mt-0.5 data-[icon-button]:rounded-sm",e),onClick:u=>{o?.(u),!u.defaultPrevented&&m.toast.dismiss(a)},ref:n,...s})}),z=d(({asChild:t,className:e,...o},s)=>r(t?l:"p",{className:i("text-strong flex-1 text-base sm:text-sm",e),ref:s,...o}));function F(t){t.target instanceof Element&&t.target.closest(".mantle-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:e,...o}){return r("div",{"aria-hidden":!0,className:i("z-1 absolute -inset-px right-auto w-1.5 rounded-l",x[e],t),...o})}export{B as a,_ as b,j as c,D as d,L as e,z as f,F as g};
2
+ //# sourceMappingURL=chunk-CD26UMMG.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 { createContext, forwardRef, useContext, type ComponentProps, type ElementRef, type ReactNode } 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(\"toaster mantle-prompt pointer-events-auto font-sans *:duration-200\", className)}\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) => <ToastIdContext.Provider value={options?.id ?? toastId}>{children}</ToastIdContext.Provider>,\n\t\t{\n\t\t\t//\n\t\t\tduration: options?.duration_ms,\n\t\t\tid: options?.id,\n\t\t\tunstyled: true,\n\t\t},\n\t);\n}\n\ntype ToastActionProps = ComponentProps<\"button\"> & WithAsChild;\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<ElementRef<\"div\">, ToastProps>(({ asChild, children, className, priority, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<ToastStateContext.Provider value={{ priority }}>\n\t\t\t<Component\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"relative flex items-start gap-2 text-base sm:text-sm\",\n\t\t\t\t\t\"p-3 pl-[0.9375rem]\",\n\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/**\n\t\t\t\t\t * Do not apply overflow-hidden because we want the priority bar accent\n\t\t\t\t\t * to overlap the toast border, else the border flows over the\n\t\t\t\t\t * priority bar.\n\t\t\t\t\t */\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<PriorityBarAccent priority={priority} />\n\t\t\t\t{children}\n\t\t\t</Component>\n\t\t</ToastStateContext.Provider>\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<ElementRef<\"svg\">, ToastIconProps>(({ className, svg, ...props }, ref) => {\n\tconst ctx = useContext(ToastStateContext);\n\n\tswitch (ctx.priority) {\n\t\tcase \"danger\":\n\t\t\treturn (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName={cx(\"text-danger-600\", className)}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tsvg={svg ?? <Warning weight=\"fill\" />}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"warning\":\n\t\t\treturn (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName={cx(\"text-warning-600\", className)}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tsvg={svg ?? <WarningDiamond weight=\"fill\" />}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"success\":\n\t\t\treturn (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName={cx(\"text-success-600\", className)}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tsvg={svg ?? <CheckCircle weight=\"fill\" />}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"info\":\n\t\t\treturn (\n\t\t\t\t<Icon\n\t\t\t\t\t//\n\t\t\t\t\tclassName={cx(\"text-accent-600\", className)}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tsvg={<Info weight=\"fill\" />}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t);\n\t\tdefault:\n\t\t\tthrow new Error(`Unreachable Case: ${ctx.priority}`);\n\t}\n});\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<ElementRef<\"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<ElementRef<\"p\">, ToastMessageProps>(({ asChild, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"p\";\n\n\treturn (\n\t\t<Component\n\t\t\t//\n\t\t\tclassName={cx(\"text-strong flex-1 text-base sm:text-sm\", className)}\n\t\t\tref={ref}\n\t\t\t{...props}\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(\".mantle-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\"> & { priority: Priority };\n\n/**\n * @private\n *\n * A colored bar that visually represents the priority of the toast.\n */\nfunction PriorityBarAccent({ className, priority, ...props }: 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":"wHAEA,OAAS,eAAAA,MAAmB,oCAC5B,OAAS,QAAAC,MAAY,6BACrB,OAAS,WAAAC,MAAe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G,EAHiBR,EAAUO,EAAO,IAGjC,CAEA,UAAWG,EAAG,0CAA2CR,CAAS,EAClE,IAAKG,EACJ,GAAGD,EACL,CAED,EAyBM,SAASsB,EACfC,EACC,CACKA,EAAM,kBAAkB,SAI1BA,EAAM,OAAO,QAAQ,gBAAgB,GACxCA,EAAM,eAAe,CAEvB,CAEA,IAAMC,EAA0B,CAC/B,KAAM,gBACN,QAAS,iBACT,QAAS,iBACT,OAAQ,eACT,EASA,SAASC,EAAkB,CAAE,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,EAA2B,CACrF,OACCC,EAAC,OACA,cAAW,GACX,UAAWC,EAEV,oDACAN,EAAwBG,CAAQ,EAChCD,CACD,EACC,GAAGE,EACL,CAEF","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*as e from"@radix-ui/react-dialog";import{createContext as l,forwardRef as a,useContext as s,useEffect as p,useState as c}from"react";import{jsx as r}from"react/jsx-runtime";var n=l({hasDescription:!1,setHasDescription:()=>{}});function f(i){let[o,t]=c(!1);return r(n.Provider,{value:{hasDescription:o,setHasDescription:t},children:r(e.Root,{...i})})}var m=e.Trigger,g=e.Portal,v=e.Close,P=e.Overlay,u=a((i,o)=>{let t=s(n);return r(e.Content,{ref:o,...t.hasDescription?{}:{"aria-describedby":void 0},...i})}),d=e.Title,C=a((i,o)=>{let t=s(n);return p(()=>(t.setHasDescription(!0),()=>t.setHasDescription(!1)),[t]),r(e.Description,{ref:o,...i})});export{f as a,m as b,g as c,v as d,P as e,u as f,d as g,C as h};
2
+ //# sourceMappingURL=chunk-J4X3ODX7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/dialog/primitive.tsx"],"sourcesContent":["import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport {\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n\tuseEffect,\n\tuseState,\n\ttype ComponentPropsWithoutRef,\n\ttype ElementRef,\n} from \"react\";\n\ntype InternalDialogContextValue = {\n\thasDescription: boolean;\n\tsetHasDescription: (value: boolean) => void;\n};\n\nconst InternalDialogContext = createContext<InternalDialogContextValue>({\n\thasDescription: false,\n\tsetHasDescription: () => {},\n});\n\nfunction Root(props: ComponentPropsWithoutRef<typeof DialogPrimitive.Root>) {\n\tconst [hasDescription, setHasDescription] = useState(false);\n\n\treturn (\n\t\t<InternalDialogContext.Provider value={{ hasDescription, setHasDescription }}>\n\t\t\t<DialogPrimitive.Root {...props} />\n\t\t</InternalDialogContext.Provider>\n\t);\n}\n\nconst Trigger = DialogPrimitive.Trigger;\n\nconst Portal = DialogPrimitive.Portal;\n\nconst Close = DialogPrimitive.Close;\n\nconst Overlay = DialogPrimitive.Overlay;\n\nconst Content = forwardRef<ElementRef<\"div\">, ComponentPropsWithoutRef<typeof DialogPrimitive.Content>>(\n\t(props, ref) => {\n\t\tconst ctx = useContext(InternalDialogContext);\n\n\t\treturn (\n\t\t\t<DialogPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\t// If there's no description, we remove the default applied aria-describedby attribute from radix dialog\n\t\t\t\t{...(!ctx.hasDescription ? { \"aria-describedby\": undefined } : {})}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nconst Title = DialogPrimitive.Title;\n\nconst Description = forwardRef<ElementRef<\"p\">, ComponentPropsWithoutRef<typeof DialogPrimitive.Description>>(\n\t(props, ref) => {\n\t\tconst ctx = useContext(InternalDialogContext);\n\n\t\tuseEffect(() => {\n\t\t\tctx.setHasDescription(true);\n\t\t\treturn () => ctx.setHasDescription(false);\n\t\t}, [ctx]);\n\n\t\treturn <DialogPrimitive.Description ref={ref} {...props} />;\n\t},\n);\n\nexport {\n\t//,\n\tRoot,\n\tTrigger,\n\tPortal,\n\tClose,\n\tOverlay,\n\tContent,\n\tDescription,\n\tTitle,\n};\n"],"mappings":"AAAA,UAAYA,MAAqB,yBACjC,OACC,iBAAAC,EACA,cAAAC,EACA,cAAAC,EACA,aAAAC,EACA,YAAAC,MAGM,QAiBJ,cAAAC,MAAA,oBAVH,IAAMC,EAAwBN,EAA0C,CACvE,eAAgB,GAChB,kBAAmB,IAAM,CAAC,CAC3B,CAAC,EAED,SAASO,EAAKC,EAA8D,CAC3E,GAAM,CAACC,EAAgBC,CAAiB,EAAIN,EAAS,EAAK,EAE1D,OACCC,EAACC,EAAsB,SAAtB,CAA+B,MAAO,CAAE,eAAAG,EAAgB,kBAAAC,CAAkB,EAC1E,SAAAL,EAAiB,OAAhB,CAAsB,GAAGG,EAAO,EAClC,CAEF,CAEA,IAAMG,EAA0B,UAE1BC,EAAyB,SAEzBC,EAAwB,QAExBC,EAA0B,UAE1BC,EAAUd,EACf,CAACO,EAAOQ,IAAQ,CACf,IAAMC,EAAMf,EAAWI,CAAqB,EAE5C,OACCD,EAAiB,UAAhB,CACA,IAAKW,EAEJ,GAAKC,EAAI,eAAqD,CAAC,EAArC,CAAE,mBAAoB,MAAU,EAC1D,GAAGT,EACL,CAEF,CACD,EAEMU,EAAwB,QAExBC,EAAclB,EACnB,CAACO,EAAOQ,IAAQ,CACf,IAAMC,EAAMf,EAAWI,CAAqB,EAE5C,OAAAH,EAAU,KACTc,EAAI,kBAAkB,EAAI,EACnB,IAAMA,EAAI,kBAAkB,EAAK,GACtC,CAACA,CAAG,CAAC,EAEDZ,EAAiB,cAAhB,CAA4B,IAAKW,EAAM,GAAGR,EAAO,CAC1D,CACD","names":["DialogPrimitive","createContext","forwardRef","useContext","useEffect","useState","jsx","InternalDialogContext","Root","props","hasDescription","setHasDescription","Trigger","Portal","Close","Overlay","Content","ref","ctx","Title","Description"]}
package/dist/dialog.d.ts CHANGED
@@ -1,34 +1,36 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ import { ComponentProps } from 'react';
4
+ import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
4
5
  import { a as IconButtonProps } from './icon-button-CZzW1XWB.js';
6
+ import { R as Root } from './primitive-hud69IM9.js';
5
7
  import 'class-variance-authority/types';
6
8
  import './as-child-Cvu56SuO.js';
7
9
  import './variant-props-oDo2u-We.js';
8
10
  import 'class-variance-authority';
9
11
  import './deep-non-nullable-SmpSvoSd.js';
10
12
 
11
- declare const Dialog: react.FC<DialogPrimitive.DialogProps>;
12
- declare const DialogTrigger: react.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
13
- declare const DialogPortal: react.FC<DialogPrimitive.DialogPortalProps>;
14
- declare const DialogClose: react.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
15
- declare const DialogOverlay: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
16
- declare const DialogContent: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
13
+ declare const Dialog: typeof Root;
14
+ declare const DialogTrigger: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
15
+ declare const DialogPortal: react.FC<_radix_ui_react_dialog.DialogPortalProps>;
16
+ declare const DialogClose: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
17
+ declare const DialogOverlay: react.ForwardRefExoticComponent<Omit<_radix_ui_react_dialog.DialogOverlayProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
18
+ declare const DialogContent: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_dialog.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
17
19
  declare const DialogHeader: {
18
- ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
20
+ ({ className, children, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
19
21
  displayName: string;
20
22
  };
21
23
  type DialogCloseIconButtonProps = Partial<Omit<IconButtonProps, "icon">>;
22
24
  declare const DialogCloseIconButton: ({ size, type, label, appearance, ...props }: DialogCloseIconButtonProps) => react_jsx_runtime.JSX.Element;
23
25
  declare const DialogBody: {
24
- ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
26
+ ({ className, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
25
27
  displayName: string;
26
28
  };
27
29
  declare const DialogFooter: {
28
- ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
30
+ ({ className, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
29
31
  displayName: string;
30
32
  };
31
- declare const DialogTitle: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
32
- declare const DialogDescription: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
33
+ declare const DialogTitle: react.ForwardRefExoticComponent<Omit<_radix_ui_react_dialog.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
34
+ declare const DialogDescription: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_dialog.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
33
35
 
34
36
  export { Dialog, DialogBody, DialogClose, DialogCloseIconButton, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
package/dist/dialog.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-7AUDKKSM.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import{a as l}from"./chunk-EW5CFGXT.js";import{X as u}from"@phosphor-icons/react/X";import*as e from"@radix-ui/react-dialog";import{forwardRef as r}from"react";import{jsx as i,jsxs as N}from"react/jsx-runtime";var P=e.Root,x=e.Trigger,g=e.Portal,C=e.Close,s=r(({className:o,...t},a)=>i(e.Overlay,{ref:a,className:l("bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm",o),...t}));s.displayName=e.Overlay.displayName;var d=r(({className:o,children:t,...a},n)=>N(g,{children:[i(s,{}),i("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:i(e.Content,{className:l("flex max-h-full w-full max-w-lg flex-1 flex-col","outline-none focus-within:outline-none","border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200","data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95",o),ref:n,...a,children:t})})]}));d.displayName=e.Content.displayName;var p=({className:o,children:t,...a})=>i("div",{className:l("border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4","has-[.icon-button]:pr-4",o),...a,children:t});p.displayName="DialogHeader";var b=({size:o="md",type:t="button",label:a="Close Dialog",appearance:n="ghost",...y})=>i(e.Close,{asChild:!0,children:i(m,{appearance:n,icon:i(u,{}),label:a,size:o,type:t,...y})}),D=({className:o,...t})=>i("div",{className:l("scrollbar text-body flex-1 overflow-y-auto p-6",o),...t});D.displayName="DialogBody";var c=({className:o,...t})=>i("div",{className:l("border-dialog-muted flex shrink-0 flex-row-reverse gap-2 border-t px-6 py-4",o),...t});c.displayName="DialogFooter";var f=r(({className:o,...t},a)=>i(e.Title,{ref:a,className:l("text-strong truncate text-lg font-medium",o),...t}));f.displayName=e.Title.displayName;var v=r(({className:o,...t},a)=>i(e.Description,{ref:a,className:l("text-muted",o),...t}));v.displayName=e.Description.displayName;export{P as Dialog,D as DialogBody,C as DialogClose,b as DialogCloseIconButton,d as DialogContent,v as DialogDescription,c as DialogFooter,p as DialogHeader,s as DialogOverlay,g as DialogPortal,f as DialogTitle,x as DialogTrigger};
1
+ import{a as P,b as v,c as u,d as m,e as p,f as d,g,h as D}from"./chunk-J4X3ODX7.js";import{g as c}from"./chunk-CD26UMMG.js";import"./chunk-273VK4KO.js";import"./chunk-D3XF6J5A.js";import{a as y}from"./chunk-BU7JVIWF.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import{a}from"./chunk-EW5CFGXT.js";import{X as I}from"@phosphor-icons/react/X";import{forwardRef as r}from"react";import{jsx as i,jsxs as W}from"react/jsx-runtime";var O=P,T=v,C=u,z=m,f=r(({className:o,...e},t)=>i(p,{ref:t,className:a("bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm",o),...e}));f.displayName=p.displayName;var x=r(({children:o,className:e,onInteractOutside:t,onPointerDownOutside:n,...s},w)=>W(C,{children:[i(f,{}),i("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:i(d,{className:a("flex max-h-full w-full max-w-lg flex-1 flex-col","outline-none focus-within:outline-none","border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200","data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95",e),onInteractOutside:l=>{c(l),t?.(l)},onPointerDownOutside:l=>{c(l),n?.(l)},ref:w,...s,children:o})})]}));x.displayName=d.displayName;var N=({className:o,children:e,...t})=>i("div",{className:a("border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4","has-[.icon-button]:pr-4",o),...t,children:e});N.displayName="DialogHeader";var E=({size:o="md",type:e="button",label:t="Close Dialog",appearance:n="ghost",...s})=>i(m,{asChild:!0,children:i(y,{appearance:n,icon:i(I,{}),label:t,size:o,type:e,...s})}),b=({className:o,...e})=>i("div",{className:a("scrollbar text-body flex-1 overflow-y-auto p-6",o),...e});b.displayName="DialogBody";var h=({className:o,...e})=>i("div",{className:a("border-dialog-muted flex shrink-0 flex-row-reverse gap-2 border-t px-6 py-4",o),...e});h.displayName="DialogFooter";var R=r(({className:o,...e},t)=>i(g,{ref:t,className:a("text-strong truncate text-lg font-medium",o),...e}));R.displayName=g.displayName;var B=r(({className:o,...e},t)=>i(D,{ref:t,className:a("text-muted",o),...e}));B.displayName=D.displayName;export{O as Dialog,b as DialogBody,z as DialogClose,E as DialogCloseIconButton,x as DialogContent,B as DialogDescription,h as DialogFooter,N as DialogHeader,f as DialogOverlay,C as DialogPortal,R as DialogTitle,T as DialogTrigger};
2
2
  //# sourceMappingURL=dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/dialog/dialog.tsx"],"sourcesContent":["import { X } from \"@phosphor-icons/react/X\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { IconButton, type IconButtonProps } from \"../button/icon-button.js\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = forwardRef<\n\tElementRef<typeof DialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Overlay\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = forwardRef<ElementRef<\"div\">, ComponentPropsWithoutRef<typeof DialogPrimitive.Content>>(\n\t({ className, children, ...props }, ref) => (\n\t\t<DialogPortal>\n\t\t\t<DialogOverlay />\n\t\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t\t<DialogPrimitive.Content\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"flex max-h-full w-full max-w-lg flex-1 flex-col\",\n\t\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</DialogPrimitive.Content>\n\t\t\t</div>\n\t\t</DialogPortal>\n\t),\n);\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\n\t\t\t\"border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4\",\n\t\t\t\"has-[.icon-button]:pr-4\", // when there are actions in the header, shorten the padding\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</div>\n);\nDialogHeader.displayName = \"DialogHeader\";\n\ntype DialogCloseIconButtonProps = Partial<Omit<IconButtonProps, \"icon\">>;\nconst DialogCloseIconButton = ({\n\tsize = \"md\",\n\ttype = \"button\",\n\tlabel = \"Close Dialog\",\n\tappearance = \"ghost\",\n\t...props\n}: DialogCloseIconButtonProps) => (\n\t<DialogPrimitive.Close asChild>\n\t\t<IconButton appearance={appearance} icon={<X />} label={label} size={size} type={type} {...props} />\n\t</DialogPrimitive.Close>\n);\n\nconst DialogBody = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"scrollbar text-body flex-1 overflow-y-auto p-6\", className)} {...props} />\n);\nDialogBody.displayName = \"DialogBody\";\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\"border-dialog-muted flex shrink-0 flex-row-reverse gap-2 border-t px-6 py-4\", className)}\n\t\t{...props}\n\t/>\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = forwardRef<\n\tElementRef<typeof DialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Title ref={ref} className={cx(\"text-strong truncate text-lg font-medium\", className)} {...props} />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = forwardRef<\n\tElementRef<typeof DialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Description ref={ref} className={cx(\"text-muted\", className)} {...props} />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n\tDialog,\n\tDialogBody,\n\tDialogClose,\n\tDialogCloseIconButton,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogOverlay,\n\tDialogPortal,\n\tDialogTitle,\n\tDialogTrigger,\n};\n"],"mappings":"4NAAA,OAAS,KAAAA,MAAS,0BAClB,UAAYC,MAAqB,yBACjC,OAAS,cAAAC,MAAkB,QAiB1B,cAAAC,EAaC,QAAAC,MAbD,oBAZD,IAAMC,EAAyB,OAEzBC,EAAgC,UAEhCC,EAA+B,SAE/BC,EAA8B,QAE9BC,EAAgBC,EAGpB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAiB,UAAhB,CACA,IAAKU,EACL,UAAWC,EACV,iKACAH,CACD,EACC,GAAGC,EACL,CACA,EACDH,EAAc,YAA8B,UAAQ,YAEpD,IAAMM,EAAgBL,EACrB,CAAC,CAAE,UAAAC,EAAW,SAAAK,EAAU,GAAGJ,CAAM,EAAGC,IACnCT,EAACG,EAAA,CACA,UAAAJ,EAACM,EAAA,EAAc,EACfN,EAAC,OAAI,UAAU,sDACd,SAAAA,EAAiB,UAAhB,CACA,UAAWW,EACV,kDACA,yCACA,wFACA,2KACAH,CACD,EACA,IAAKE,EACJ,GAAGD,EAEH,SAAAI,EACF,EACD,GACD,CAEF,EACAD,EAAc,YAA8B,UAAQ,YAEpD,IAAME,EAAe,CAAC,CAAE,UAAAN,EAAW,SAAAK,EAAU,GAAGJ,CAAM,IACrDT,EAAC,OACA,UAAWW,EACV,+GACA,0BACAH,CACD,EACC,GAAGC,EAEH,SAAAI,EACF,EAEDC,EAAa,YAAc,eAG3B,IAAMC,EAAwB,CAAC,CAC9B,KAAAC,EAAO,KACP,KAAAC,EAAO,SACP,MAAAC,EAAQ,eACR,WAAAC,EAAa,QACb,GAAGV,CACJ,IACCT,EAAiB,QAAhB,CAAsB,QAAO,GAC7B,SAAAA,EAACoB,EAAA,CAAW,WAAYD,EAAY,KAAMnB,EAACqB,EAAA,EAAE,EAAI,MAAOH,EAAO,KAAMF,EAAM,KAAMC,EAAO,GAAGR,EAAO,EACnG,EAGKa,EAAa,CAAC,CAAE,UAAAd,EAAW,GAAGC,CAAM,IACzCT,EAAC,OAAI,UAAWW,EAAG,iDAAkDH,CAAS,EAAI,GAAGC,EAAO,EAE7Fa,EAAW,YAAc,aAEzB,IAAMC,EAAe,CAAC,CAAE,UAAAf,EAAW,GAAGC,CAAM,IAC3CT,EAAC,OACA,UAAWW,EAAG,8EAA+EH,CAAS,EACrG,GAAGC,EACL,EAEDc,EAAa,YAAc,eAE3B,IAAMC,EAAcjB,EAGlB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAiB,QAAhB,CAAsB,IAAKU,EAAK,UAAWC,EAAG,2CAA4CH,CAAS,EAAI,GAAGC,EAAO,CAClH,EACDe,EAAY,YAA8B,QAAM,YAEhD,IAAMC,EAAoBlB,EAGxB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAiB,cAAhB,CAA4B,IAAKU,EAAK,UAAWC,EAAG,aAAcH,CAAS,EAAI,GAAGC,EAAO,CAC1F,EACDgB,EAAkB,YAA8B,cAAY","names":["X","DialogPrimitive","forwardRef","jsx","jsxs","Dialog","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","forwardRef","className","props","ref","cx","DialogContent","children","DialogHeader","DialogCloseIconButton","size","type","label","appearance","IconButton","X","DialogBody","DialogFooter","DialogTitle","DialogDescription"]}
1
+ {"version":3,"sources":["../src/components/dialog/dialog.tsx"],"sourcesContent":["import { X } from \"@phosphor-icons/react/X\";\nimport type { ComponentProps, ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { IconButton, type IconButtonProps } from \"../button/icon-button.js\";\nimport { preventCloseOnPromptInteraction } from \"../toast/toast.js\";\nimport * as DialogPrimitive from \"./primitive.js\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = forwardRef<ElementRef<\"div\">, ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>>(\n\t({ className, ...props }, ref) => (\n\t\t<DialogPrimitive.Overlay\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = forwardRef<ElementRef<\"div\">, ComponentPropsWithoutRef<typeof DialogPrimitive.Content>>(\n\t({ children, className, onInteractOutside, onPointerDownOutside, ...props }, ref) => (\n\t\t<DialogPortal>\n\t\t\t<DialogOverlay />\n\t\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t\t<DialogPrimitive.Content\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"flex max-h-full w-full max-w-lg flex-1 flex-col\",\n\t\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tonInteractOutside={(event) => {\n\t\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\t\tonInteractOutside?.(event);\n\t\t\t\t\t}}\n\t\t\t\t\tonPointerDownOutside={(event) => {\n\t\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\t\tonPointerDownOutside?.(event);\n\t\t\t\t\t}}\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</DialogPrimitive.Content>\n\t\t\t</div>\n\t\t</DialogPortal>\n\t),\n);\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, children, ...props }: ComponentProps<\"div\">) => (\n\t<div\n\t\tclassName={cx(\n\t\t\t\"border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4\",\n\t\t\t\"has-[.icon-button]:pr-4\", // when there are actions in the header, shorten the padding\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</div>\n);\nDialogHeader.displayName = \"DialogHeader\";\n\ntype DialogCloseIconButtonProps = Partial<Omit<IconButtonProps, \"icon\">>;\nconst DialogCloseIconButton = ({\n\tsize = \"md\",\n\ttype = \"button\",\n\tlabel = \"Close Dialog\",\n\tappearance = \"ghost\",\n\t...props\n}: DialogCloseIconButtonProps) => (\n\t<DialogPrimitive.Close asChild>\n\t\t<IconButton appearance={appearance} icon={<X />} label={label} size={size} type={type} {...props} />\n\t</DialogPrimitive.Close>\n);\n\nconst DialogBody = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div className={cx(\"scrollbar text-body flex-1 overflow-y-auto p-6\", className)} {...props} />\n);\nDialogBody.displayName = \"DialogBody\";\n\nconst DialogFooter = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div\n\t\tclassName={cx(\"border-dialog-muted flex shrink-0 flex-row-reverse gap-2 border-t px-6 py-4\", className)}\n\t\t{...props}\n\t/>\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = forwardRef<\n\tElementRef<typeof DialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Title ref={ref} className={cx(\"text-strong truncate text-lg font-medium\", className)} {...props} />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = forwardRef<ElementRef<\"p\">, ComponentPropsWithoutRef<typeof DialogPrimitive.Description>>(\n\t({ className, ...props }, ref) => (\n\t\t<DialogPrimitive.Description ref={ref} className={cx(\"text-muted\", className)} {...props} />\n\t),\n);\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n\tDialog,\n\tDialogBody,\n\tDialogClose,\n\tDialogCloseIconButton,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogOverlay,\n\tDialogPortal,\n\tDialogTitle,\n\tDialogTrigger,\n};\n"],"mappings":"2YAAA,OAAS,KAAAA,MAAS,0BAElB,OAAS,cAAAC,MAAkB,QAgBzB,cAAAC,EAcA,QAAAC,MAdA,oBAVF,IAAMC,EAAyBC,EAEzBC,EAAgCC,EAEhCC,EAA+BC,EAE/BC,EAA8BC,EAE9BC,EAAgBC,EACrB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzBd,EAAiBe,EAAhB,CACA,IAAKD,EACL,UAAWE,EACV,iKACAJ,CACD,EACC,GAAGC,EACL,CAEF,EACAH,EAAc,YAA8BK,EAAQ,YAEpD,IAAME,EAAgBN,EACrB,CAAC,CAAE,SAAAO,EAAU,UAAAN,EAAW,kBAAAO,EAAmB,qBAAAC,EAAsB,GAAGP,CAAM,EAAGC,IAC5Eb,EAACK,EAAA,CACA,UAAAN,EAACU,EAAA,EAAc,EACfV,EAAC,OAAI,UAAU,sDACd,SAAAA,EAAiBqB,EAAhB,CACA,UAAWL,EACV,kDACA,yCACA,wFACA,2KACAJ,CACD,EACA,kBAAoBU,GAAU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,EAAW,GAAGC,CAAM,EAAGC,IACzBd,EAAiBqC,EAAhB,CAA4B,IAAKvB,EAAK,UAAWE,EAAG,aAAcJ,CAAS,EAAI,GAAGC,EAAO,CAE5F,EACAuB,EAAkB,YAA8BC,EAAY","names":["X","forwardRef","jsx","jsxs","Dialog","Root","DialogTrigger","Trigger","DialogPortal","Portal","DialogClose","Close","DialogOverlay","forwardRef","className","props","ref","Overlay","cx","DialogContent","children","onInteractOutside","onPointerDownOutside","Content","event","preventCloseOnPromptInteraction","DialogHeader","DialogCloseIconButton","size","type","label","appearance","IconButton","X","DialogBody","DialogFooter","DialogTitle","Title","DialogDescription","Description"]}
package/dist/hooks.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-D3XF6J5A.js";import{a as u}from"./chunk-IWKI4XHM.js";import{useEffect as c,useMemo as f,useRef as i}from"react";function s(e){let t=i(e);return c(()=>{t.current=e}),f(()=>(...r)=>t.current?.(...r),[])}import{useCallback as m,useEffect as d,useRef as p}from"react";function l(e,t){let r=s(e),o=p(0);return d(()=>()=>window.clearTimeout(o.current),[]),m((...n)=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>r(...n),t.waitMs)},[r,t.waitMs])}import{useEffect as b,useLayoutEffect as x}from"react";var y=typeof window<"u"?x:b;import{useEffect as M,useState as w}from"react";var R="(prefers-reduced-motion: no-preference)";function T(){let[e,t]=w(!0);return M(()=>{let r=window.matchMedia(R);t(!r.matches);function o(n){t(!n.matches)}return r.addEventListener("change",o),()=>{r.removeEventListener("change",o)}},[]),e}import{useMemo as E}from"react";var h=(e="mantle")=>E(()=>C(e),[e]);function C(e="mantle"){return[e.trim()||"mantle",k()].join("-")}function k(){return Math.random().toString(36).substring(2,9)}export{s as useCallbackRef,u as useCopyToClipboard,l as useDebouncedCallback,y as useIsomorphicLayoutEffect,a as useMatchesMediaQuery,T as usePrefersReducedMotion,h as useRandomStableId};
1
+ import{a}from"./chunk-IWKI4XHM.js";import{a as u}from"./chunk-D3XF6J5A.js";import{useEffect as c,useMemo as f,useRef as i}from"react";function s(e){let t=i(e);return c(()=>{t.current=e}),f(()=>(...r)=>t.current?.(...r),[])}import{useCallback as m,useEffect as d,useRef as p}from"react";function l(e,t){let r=s(e),o=p(0);return d(()=>()=>window.clearTimeout(o.current),[]),m((...n)=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>r(...n),t.waitMs)},[r,t.waitMs])}import{useEffect as b,useLayoutEffect as x}from"react";var y=typeof window<"u"?x:b;import{useEffect as M,useState as w}from"react";var R="(prefers-reduced-motion: no-preference)";function T(){let[e,t]=w(!0);return M(()=>{let r=window.matchMedia(R);t(!r.matches);function o(n){t(!n.matches)}return r.addEventListener("change",o),()=>{r.removeEventListener("change",o)}},[]),e}import{useMemo as E}from"react";var h=(e="mantle")=>E(()=>C(e),[e]);function C(e="mantle"){return[e.trim()||"mantle",k()].join("-")}function k(){return Math.random().toString(36).substring(2,9)}export{s as useCallbackRef,a as useCopyToClipboard,l as useDebouncedCallback,y as useIsomorphicLayoutEffect,u as useMatchesMediaQuery,T as usePrefersReducedMotion,h as useRandomStableId};
2
2
  //# sourceMappingURL=hooks.js.map
@@ -19,4 +19,4 @@ type IconProps = Omit<SvgAttributes, "children"> & {
19
19
  */
20
20
  declare const Icon: react.ForwardRefExoticComponent<Omit<IconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
21
21
 
22
- export { type IconProps as I, Icon as a };
22
+ export { Icon as I, type IconProps as a };
package/dist/icon.d.ts CHANGED
@@ -1,27 +1,4 @@
1
- export { a as Icon, I as IconProps } from './icon-uC5dwP06.js';
2
- import * as react from 'react';
3
- import { ReactNode } from 'react';
4
- import { S as SvgAttributes } from './types-BuKAGhC-.js';
5
-
6
- type SvgOnlyProps = Omit<SvgAttributes, "children"> & {
7
- /**
8
- * A single SVG icon element.
9
- */
10
- svg: ReactNode;
11
- };
12
- /**
13
- * Accepts a single SVG icon element and decorates it with `shrink-0` class.
14
- *
15
- * Merges `className` selectors with the following order of precedence (last one wins):
16
- * 1. SvgOnly base classes ("shrink-0")
17
- * 2. SvgOnly className
18
- * 3. svg className
19
- *
20
- * You probably want to use the `Icon` component instead.
21
- *
22
- * The main difference between `Icon` and `SvgOnly` is that `SvgOnly` does not
23
- * apply any default sizing styles, only `shrink-0`.
24
- */
25
- declare const SvgOnly: react.ForwardRefExoticComponent<Omit<SvgOnlyProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
26
-
27
- export { SvgAttributes, SvgOnly, type SvgOnlyProps };
1
+ export { I as Icon, a as IconProps } from './icon-D6P9AESZ.js';
2
+ export { S as SvgOnly, a as SvgOnlyProps } from './svg-only-CS2INnEL.js';
3
+ export { S as SvgAttributes } from './types-BuKAGhC-.js';
4
+ import 'react';
@@ -1,2 +1,2 @@
1
- import{a as b,c as v,d as x,e as y,g as h}from"./chunk-E6LNHWJ3.js";import{b as z}from"./chunk-CXQLUXDJ.js";import"./chunk-5E73VWJX.js";import{a as d}from"./chunk-2YAPDW3F.js";import{a as l}from"./chunk-7AUDKKSM.js";import"./chunk-MJVZHJQA.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import{a as p}from"./chunk-EW5CFGXT.js";import{CaretLeft as j}from"@phosphor-icons/react/dist/icons/CaretLeft";import{CaretRight as k}from"@phosphor-icons/react/dist/icons/CaretRight";import{Slot as A}from"@radix-ui/react-slot";import{createContext as F,forwardRef as m,useContext as N,useState as W}from"react";import P from"tiny-invariant";import{jsx as s,jsxs as f}from"react/jsx-runtime";var c=F(void 0),O=m(({className:n,children:e,defaultPageSize:a,...t},i)=>{let[o,r]=W(a);return s(c.Provider,{value:{defaultPageSize:a,pageSize:o,setPageSize:r},children:s("div",{className:p("inline-flex items-center justify-between gap-2",n),ref:i,...t,children:e})})});O.displayName="CursorPagination";var T=m(({hasNextPage:n,hasPreviousPage:e,onNextPage:a,onPreviousPage:t,...i},o)=>f(d,{appearance:"panel",ref:o,...i,children:[s(l,{appearance:"ghost",disabled:!e,icon:s(j,{}),label:"Previous page",onClick:t,size:"sm",type:"button"}),s(z,{orientation:"vertical",className:"min-h-5"}),s(l,{appearance:"ghost",disabled:!n,icon:s(k,{}),label:"Next page",onClick:a,size:"sm",type:"button"})]}));T.displayName="CursorButtons";var $=[5,10,20,50,100],B=m(({className:n,pageSizes:e=$,onChangePageSize:a,...t},i)=>{let o=N(c);return P(o,"CursorPageSizeSelect must be used as a child of a CursorPagination component"),P(e.includes(o.defaultPageSize),"CursorPagination.defaultPageSize must be included in CursorPageSizeSelect.pageSizes"),P(e.includes(o.pageSize),"CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes"),f(b,{defaultValue:`${o.pageSize}`,onChange:r=>{let g=Number.parseInt(r,10);Number.isNaN(g)&&(g=o.defaultPageSize),o.setPageSize(g),a?.(g)},children:[s(x,{ref:i,className:p("w-auto min-w-36",n),value:o.pageSize,...t,children:s(v,{})}),s(y,{width:"trigger",children:e.map(r=>f(h,{value:`${r}`,children:[r," per page"]},r))})]})});B.displayName="CursorPageSizeSelect";function D({asChild:n=!1,className:e,...a}){let t=N(c);return P(t,"CursorPageSizeValue must be used as a child of a CursorPagination component"),f(n?A:"span",{className:p("text-muted text-sm font-normal",e),...a,children:[t.pageSize," per page"]})}import{useEffect as V,useState as w}from"react";function H({listSize:n,pageSize:e}){let[a,t]=w(1),[i,o]=w(e);V(()=>{o(e),t(1)},[e]),V(()=>{t(1)},[n]);let r=Math.ceil(n/i),g=(a-1)*i,S=a>1,C=a<r;function M(u){let U=Math.max(1,Math.min(u,r));t(U)}function E(){C&&t(u=>Math.min(u+1,r))}function R(){S&&t(u=>Math.max(u-1,1))}function G(u){o(u),t(1)}function I(){t(r)}function L(){t(1)}return{currentPage:a,goToFirstPage:L,goToLastPage:I,goToPage:M,hasNextPage:C,hasPreviousPage:S,nextPage:E,offset:g,pageSize:i,previousPage:R,setPageSize:G,totalPages:r}}function q(n,e){return n.slice(e.offset,e.offset+e.pageSize)}export{T as CursorButtons,B as CursorPageSizeSelect,D as CursorPageSizeValue,O as CursorPagination,q as getOffsetPaginatedSlice,H as useOffsetPagination};
1
+ import{a as b,c as v,d as x,e as y,g as h}from"./chunk-E6LNHWJ3.js";import{b as z}from"./chunk-CXQLUXDJ.js";import"./chunk-5E73VWJX.js";import{a as d}from"./chunk-2YAPDW3F.js";import{a as l}from"./chunk-BU7JVIWF.js";import"./chunk-MJVZHJQA.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import{a as p}from"./chunk-EW5CFGXT.js";import{CaretLeft as j}from"@phosphor-icons/react/dist/icons/CaretLeft";import{CaretRight as k}from"@phosphor-icons/react/dist/icons/CaretRight";import{Slot as A}from"@radix-ui/react-slot";import{createContext as F,forwardRef as m,useContext as N,useState as W}from"react";import P from"tiny-invariant";import{jsx as s,jsxs as f}from"react/jsx-runtime";var c=F(void 0),O=m(({className:n,children:e,defaultPageSize:a,...t},i)=>{let[o,r]=W(a);return s(c.Provider,{value:{defaultPageSize:a,pageSize:o,setPageSize:r},children:s("div",{className:p("inline-flex items-center justify-between gap-2",n),ref:i,...t,children:e})})});O.displayName="CursorPagination";var T=m(({hasNextPage:n,hasPreviousPage:e,onNextPage:a,onPreviousPage:t,...i},o)=>f(d,{appearance:"panel",ref:o,...i,children:[s(l,{appearance:"ghost",disabled:!e,icon:s(j,{}),label:"Previous page",onClick:t,size:"sm",type:"button"}),s(z,{orientation:"vertical",className:"min-h-5"}),s(l,{appearance:"ghost",disabled:!n,icon:s(k,{}),label:"Next page",onClick:a,size:"sm",type:"button"})]}));T.displayName="CursorButtons";var $=[5,10,20,50,100],B=m(({className:n,pageSizes:e=$,onChangePageSize:a,...t},i)=>{let o=N(c);return P(o,"CursorPageSizeSelect must be used as a child of a CursorPagination component"),P(e.includes(o.defaultPageSize),"CursorPagination.defaultPageSize must be included in CursorPageSizeSelect.pageSizes"),P(e.includes(o.pageSize),"CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes"),f(b,{defaultValue:`${o.pageSize}`,onChange:r=>{let g=Number.parseInt(r,10);Number.isNaN(g)&&(g=o.defaultPageSize),o.setPageSize(g),a?.(g)},children:[s(x,{ref:i,className:p("w-auto min-w-36",n),value:o.pageSize,...t,children:s(v,{})}),s(y,{width:"trigger",children:e.map(r=>f(h,{value:`${r}`,children:[r," per page"]},r))})]})});B.displayName="CursorPageSizeSelect";function D({asChild:n=!1,className:e,...a}){let t=N(c);return P(t,"CursorPageSizeValue must be used as a child of a CursorPagination component"),f(n?A:"span",{className:p("text-muted text-sm font-normal",e),...a,children:[t.pageSize," per page"]})}import{useEffect as V,useState as w}from"react";function H({listSize:n,pageSize:e}){let[a,t]=w(1),[i,o]=w(e);V(()=>{o(e),t(1)},[e]),V(()=>{t(1)},[n]);let r=Math.ceil(n/i),g=(a-1)*i,S=a>1,C=a<r;function M(u){let U=Math.max(1,Math.min(u,r));t(U)}function E(){C&&t(u=>Math.min(u+1,r))}function R(){S&&t(u=>Math.max(u-1,1))}function G(u){o(u),t(1)}function I(){t(r)}function L(){t(1)}return{currentPage:a,goToFirstPage:L,goToLastPage:I,goToPage:M,hasNextPage:C,hasPreviousPage:S,nextPage:E,offset:g,pageSize:i,previousPage:R,setPageSize:G,totalPages:r}}function q(n,e){return n.slice(e.offset,e.offset+e.pageSize)}export{T as CursorButtons,B as CursorPageSizeSelect,D as CursorPageSizeValue,O as CursorPagination,q as getOffsetPaginatedSlice,H as useOffsetPagination};
2
2
  //# sourceMappingURL=pagination.js.map
@@ -0,0 +1,7 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
4
+
5
+ declare function Root(props: ComponentPropsWithoutRef<typeof _radix_ui_react_dialog.Root>): react_jsx_runtime.JSX.Element;
6
+
7
+ export { Root as R };
package/dist/sheet.d.ts CHANGED
@@ -2,9 +2,10 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as class_variance_authority_types from 'class-variance-authority/types';
3
3
  import * as react from 'react';
4
4
  import { HTMLAttributes } from 'react';
5
- import * as DialogPrimitive from '@radix-ui/react-dialog';
5
+ import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
6
6
  import { VariantProps } from 'class-variance-authority';
7
7
  import { a as IconButtonProps } from './icon-button-CZzW1XWB.js';
8
+ import { R as Root } from './primitive-hud69IM9.js';
8
9
  import './as-child-Cvu56SuO.js';
9
10
  import './variant-props-oDo2u-We.js';
10
11
  import './deep-non-nullable-SmpSvoSd.js';
@@ -13,35 +14,35 @@ import './deep-non-nullable-SmpSvoSd.js';
13
14
  * The root component for a sheet. Should compose the `SheetTrigger` and `SheetContent`.
14
15
  * Acts as a stateful provider for the sheet's open/closed state.
15
16
  */
16
- declare const Sheet: react.FC<DialogPrimitive.DialogProps>;
17
+ declare const Sheet: typeof Root;
17
18
  /**
18
19
  * The trigger for a sheet. Should be rendered as a child of the `Sheet` component.
19
20
  * Renders an unstyled button by default, but can be customized with the `asChild` prop.
20
21
  */
21
- declare const SheetTrigger: react.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
22
+ declare const SheetTrigger: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
22
23
  /**
23
24
  * The close button for a sheet. Should be rendered as a child of the `SheetContent` component.
24
25
  * Renders an unstyled button by default, but can be customized with the `asChild` prop.
25
26
  */
26
- declare const SheetClose: react.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
27
+ declare const SheetClose: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
27
28
  /**
28
29
  * The portal for a sheet. Should be rendered as a child of the `Sheet` component.
29
30
  * Renders a portal that the `SheetOverlay` and `SheetContent` is rendered into.
30
31
  *
31
32
  * You likely don't need to use this component directly, as it is used internally by the `SheetContent` component.
32
33
  */
33
- declare const SheetPortal: react.FC<DialogPrimitive.DialogPortalProps>;
34
+ declare const SheetPortal: react.FC<_radix_ui_react_dialog.DialogPortalProps>;
34
35
  /**
35
36
  * The overlay backdrop for a sheet. Should be rendered as a child of the `SheetPortal` component.
36
37
  *
37
38
  * You likely don't need to use this component directly, as it is used internally by the `SheetContent` component.
38
39
  */
39
- declare const SheetOverlay: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
40
+ declare const SheetOverlay: react.ForwardRefExoticComponent<Omit<_radix_ui_react_dialog.DialogOverlayProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
40
41
  /**
41
42
  * The main container for a sheet. Renders on top of the overlay backdrop.
42
43
  * Should compose the `SheetHeader`, `SheetBody`, and `SheetFooter`.
43
44
  */
44
- declare const SheetContent: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & VariantProps<(props?: ({
45
+ declare const SheetContent: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_dialog.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & VariantProps<(props?: ({
45
46
  side?: "left" | "right" | "bottom" | "top" | null | undefined;
46
47
  } & class_variance_authority_types.ClassProp) | undefined) => string> & react.RefAttributes<HTMLDivElement>>;
47
48
  type SheetCloseIconButtonProps = Partial<Omit<IconButtonProps, "icon">>;
@@ -68,7 +69,7 @@ declare const SheetFooter: ({ className, ...props }: HTMLAttributes<HTMLDivEleme
68
69
  * The title for a sheet. Typically rendered as a child of `SheetTitleGroup`.
69
70
  * Defaults to an `h2` element, but can be changed via the `asChild` prop.
70
71
  */
71
- declare const SheetTitle: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
72
+ declare const SheetTitle: react.ForwardRefExoticComponent<Omit<_radix_ui_react_dialog.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
72
73
  /**
73
74
  * A group container for the title and actions of a sheet. Typically rendered as a child of `SheetHeader`.
74
75
  */
@@ -76,7 +77,7 @@ declare const SheetTitleGroup: react.ForwardRefExoticComponent<HTMLAttributes<HT
76
77
  /**
77
78
  * A description for a sheet. Typically rendered as a child of `SheetHeader`.
78
79
  */
79
- declare const SheetDescription: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
80
+ declare const SheetDescription: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_dialog.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
80
81
  /**
81
82
  * A group container for the actions of a sheet. Typically rendered as a child of `SheetTitleGroup`.
82
83
  */
package/dist/sheet.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as d}from"./chunk-7AUDKKSM.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import{a}from"./chunk-EW5CFGXT.js";import{X as v}from"@phosphor-icons/react/X";import*as e from"@radix-ui/react-dialog";import{cva as y}from"class-variance-authority";import{forwardRef as n}from"react";import{jsx as r,jsxs as H}from"react/jsx-runtime";var P=e.Root,b=e.Trigger,g=e.Close,p=e.Portal,m=n(({className:t,...o},i)=>r(e.Overlay,{className:a("bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-40 backdrop-blur-sm",t),...o,ref:i}));m.displayName=e.Overlay.displayName;var C=y("bg-dialog data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in fixed z-40 flex flex-col shadow-lg outline-none transition ease-in-out focus-within:outline-none",{variants:{side:{top:"border-dialog data-state-closed:slide-out-to-top data-state-open:slide-in-from-top inset-x-0 top-0 border-b",bottom:"border-dialog data-state-closed:slide-out-to-bottom data-state-open:slide-in-from-bottom inset-x-0 bottom-0 border-t",left:"border-dialog data-state-closed:slide-out-to-left data-state-open:slide-in-from-left inset-y-0 left-0 h-full w-full border-r sm:max-w-[30rem]",right:"border-dialog data-state-closed:slide-out-to-right data-state-open:slide-in-from-right inset-y-0 right-0 h-full w-full border-l sm:max-w-[30rem]"}},defaultVariants:{side:"right"}}),h=n(({side:t="right",className:o,children:i,...s},l)=>H(p,{children:[r(m,{}),r(e.Content,{ref:l,className:a(C({side:t}),o),...s,children:i})]}));h.displayName=e.Content.displayName;var x=({size:t="md",type:o="button",label:i="Close Sheet",appearance:s="ghost",...l})=>r(e.Close,{asChild:!0,children:r(d,{appearance:s,icon:r(v,{}),label:i,size:t,type:o,...l})}),T=({className:t,...o})=>r("div",{className:a("scrollbar text-body flex-1 overflow-y-auto p-6",t),...o}),N=({className:t,...o})=>r("div",{className:a("border-dialog-muted flex shrink-0 flex-col gap-2 border-b py-4 pl-6 pr-4","has-[.icon-button]:pr-4",t),...o}),R=({className:t,...o})=>r("div",{className:a("border-dialog-muted flex shrink-0 justify-end gap-2 border-t px-6 py-2.5",t),...o}),f=n(({className:t,...o},i)=>r(e.Title,{ref:i,className:a("text-strong flex-1 truncate text-lg font-medium",t),...o}));f.displayName=e.Title.displayName;var c=n(({children:t,className:o,...i},s)=>r("div",{className:a("flex items-center justify-between gap-2",o),...i,ref:s,children:t}));c.displayName="SheetTitleGroup";var S=n(({className:t,...o},i)=>r(e.Description,{ref:i,className:a("text-body text-sm",t),...o}));S.displayName=e.Description.displayName;var u=n(({children:t,className:o,...i},s)=>r("div",{className:a("flex h-full items-center gap-2",o),...i,ref:s,children:t}));u.displayName="SheetActions";export{P as Sheet,u as SheetActions,T as SheetBody,g as SheetClose,x as SheetCloseIconButton,h as SheetContent,S as SheetDescription,R as SheetFooter,N as SheetHeader,m as SheetOverlay,p as SheetPortal,f as SheetTitle,c as SheetTitleGroup,b as SheetTrigger};
1
+ import{a as u,b as v,c as P,d as m,e as d,f as p,g as h,h as f}from"./chunk-J4X3ODX7.js";import{g as c}from"./chunk-CD26UMMG.js";import"./chunk-273VK4KO.js";import"./chunk-D3XF6J5A.js";import{a as y}from"./chunk-BU7JVIWF.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-72TJUKMV.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import{a as r}from"./chunk-EW5CFGXT.js";import{X as D}from"@phosphor-icons/react/X";import{cva as E}from"class-variance-authority";import{forwardRef as s}from"react";import{jsx as i,jsxs as W}from"react/jsx-runtime";var L=u,M=v,w=m,b=P,S=s(({className:e,...t},o)=>i(d,{className:r("bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-40 backdrop-blur-sm",e),...t,ref:o}));S.displayName=d.displayName;var O=E("bg-dialog data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in fixed z-40 flex flex-col shadow-lg outline-none transition ease-in-out focus-within:outline-none",{variants:{side:{top:"border-dialog data-state-closed:slide-out-to-top data-state-open:slide-in-from-top inset-x-0 top-0 border-b",bottom:"border-dialog data-state-closed:slide-out-to-bottom data-state-open:slide-in-from-bottom inset-x-0 bottom-0 border-t",left:"border-dialog data-state-closed:slide-out-to-left data-state-open:slide-in-from-left inset-y-0 left-0 h-full w-full border-r sm:max-w-[30rem]",right:"border-dialog data-state-closed:slide-out-to-right data-state-open:slide-in-from-right inset-y-0 right-0 h-full w-full border-l sm:max-w-[30rem]"}},defaultVariants:{side:"right"}}),g=s(({children:e,className:t,onInteractOutside:o,onPointerDownOutside:a,side:l="right",...R},H)=>W(b,{children:[i(S,{}),i(p,{className:r(O({side:l}),t),onInteractOutside:n=>{c(n),o?.(n)},onPointerDownOutside:n=>{c(n),a?.(n)},ref:H,...R,children:e})]}));g.displayName=p.displayName;var A=({size:e="md",type:t="button",label:o="Close Sheet",appearance:a="ghost",...l})=>i(m,{asChild:!0,children:i(y,{appearance:a,icon:i(D,{}),label:o,size:e,type:t,...l})}),B=({className:e,...t})=>i("div",{className:r("scrollbar text-body flex-1 overflow-y-auto p-6",e),...t}),I=({className:e,...t})=>i("div",{className:r("border-dialog-muted flex shrink-0 flex-col gap-2 border-b py-4 pl-6 pr-4","has-[.icon-button]:pr-4",e),...t}),V=({className:e,...t})=>i("div",{className:r("border-dialog-muted flex shrink-0 justify-end gap-2 border-t px-6 py-2.5",e),...t}),C=s(({className:e,...t},o)=>i(h,{ref:o,className:r("text-strong flex-1 truncate text-lg font-medium",e),...t}));C.displayName=h.displayName;var x=s(({children:e,className:t,...o},a)=>i("div",{className:r("flex items-center justify-between gap-2",t),...o,ref:a,children:e}));x.displayName="SheetTitleGroup";var T=s(({className:e,...t},o)=>i(f,{ref:o,className:r("text-body text-sm",e),...t}));T.displayName=f.displayName;var N=s(({children:e,className:t,...o},a)=>i("div",{className:r("flex h-full items-center gap-2",t),...o,ref:a,children:e}));N.displayName="SheetActions";export{L as Sheet,N as SheetActions,B as SheetBody,w as SheetClose,A as SheetCloseIconButton,g as SheetContent,T as SheetDescription,V as SheetFooter,I as SheetHeader,S as SheetOverlay,b as SheetPortal,C as SheetTitle,x as SheetTitleGroup,M as SheetTrigger};
2
2
  //# sourceMappingURL=sheet.js.map
package/dist/sheet.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/sheet/sheet.tsx"],"sourcesContent":["import { X } from \"@phosphor-icons/react/X\";\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef, HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { IconButton, type IconButtonProps } from \"../button/icon-button.js\";\n\n/**\n * The root component for a sheet. Should compose the `SheetTrigger` and `SheetContent`.\n * Acts as a stateful provider for the sheet's open/closed state.\n */\nconst Sheet = SheetPrimitive.Root;\n\n/**\n * The trigger for a sheet. Should be rendered as a child of the `Sheet` component.\n * Renders an unstyled button by default, but can be customized with the `asChild` prop.\n */\nconst SheetTrigger = SheetPrimitive.Trigger;\n\n/**\n * The close button for a sheet. Should be rendered as a child of the `SheetContent` component.\n * Renders an unstyled button by default, but can be customized with the `asChild` prop.\n */\nconst SheetClose = SheetPrimitive.Close;\n\n/**\n * The portal for a sheet. Should be rendered as a child of the `Sheet` component.\n * Renders a portal that the `SheetOverlay` and `SheetContent` is rendered into.\n *\n * You likely don't need to use this component directly, as it is used internally by the `SheetContent` component.\n */\nconst SheetPortal = SheetPrimitive.Portal;\n\n/**\n * The overlay backdrop for a sheet. Should be rendered as a child of the `SheetPortal` component.\n *\n * You likely don't need to use this component directly, as it is used internally by the `SheetContent` component.\n */\nconst SheetOverlay = forwardRef<\n\tElementRef<typeof SheetPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<SheetPrimitive.Overlay\n\t\tclassName={cx(\n\t\t\t\"bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-40 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t\tref={ref}\n\t/>\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nconst SheetVariants = cva(\n\t\"bg-dialog data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in fixed z-40 flex flex-col shadow-lg outline-none transition ease-in-out focus-within:outline-none\",\n\t{\n\t\tvariants: {\n\t\t\tside: {\n\t\t\t\ttop: \"border-dialog data-state-closed:slide-out-to-top data-state-open:slide-in-from-top inset-x-0 top-0 border-b\",\n\t\t\t\tbottom:\n\t\t\t\t\t\"border-dialog data-state-closed:slide-out-to-bottom data-state-open:slide-in-from-bottom inset-x-0 bottom-0 border-t\",\n\t\t\t\tleft: \"border-dialog data-state-closed:slide-out-to-left data-state-open:slide-in-from-left inset-y-0 left-0 h-full w-full border-r sm:max-w-[30rem]\",\n\t\t\t\tright:\n\t\t\t\t\t\"border-dialog data-state-closed:slide-out-to-right data-state-open:slide-in-from-right inset-y-0 right-0 h-full w-full border-l sm:max-w-[30rem]\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tside: \"right\",\n\t\t},\n\t},\n);\n\ntype SheetContentProps = {} & ComponentPropsWithoutRef<typeof SheetPrimitive.Content> &\n\tVariantProps<typeof SheetVariants>;\n\n/**\n * The main container for a sheet. Renders on top of the overlay backdrop.\n * Should compose the `SheetHeader`, `SheetBody`, and `SheetFooter`.\n */\nconst SheetContent = forwardRef<ElementRef<typeof SheetPrimitive.Content>, SheetContentProps>(\n\t({ side = \"right\", className, children, ...props }, ref) => (\n\t\t<SheetPortal>\n\t\t\t<SheetOverlay />\n\t\t\t<SheetPrimitive.Content ref={ref} className={cx(SheetVariants({ side }), className)} {...props}>\n\t\t\t\t{children}\n\t\t\t</SheetPrimitive.Content>\n\t\t</SheetPortal>\n\t),\n);\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\ntype SheetCloseIconButtonProps = Partial<Omit<IconButtonProps, \"icon\">>;\n\n/**\n * An icon button that closes the sheet when clicked. Should be rendered within the `SheetHeader` as a child of `SheetActions`.\n */\nconst SheetCloseIconButton = ({\n\tsize = \"md\",\n\ttype = \"button\",\n\tlabel = \"Close Sheet\",\n\tappearance = \"ghost\",\n\t...props\n}: SheetCloseIconButtonProps) => (\n\t<SheetPrimitive.Close asChild>\n\t\t<IconButton appearance={appearance} icon={<X />} label={label} size={size} type={type} {...props} />\n\t</SheetPrimitive.Close>\n);\n\n/**\n * The body container for a sheet. This is where you would typically place the main content of the sheet.\n * Should be rendered as a child of `SheetContent`.\n */\nconst SheetBody = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"scrollbar text-body flex-1 overflow-y-auto p-6\", className)} {...props} />\n);\n\n/**\n * The header container for a sheet. This is where you would typically place the title, description, and actions.\n * Should be rendered as a child of `SheetContent`.\n */\nconst SheetHeader = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\n\t\t\t\"border-dialog-muted flex shrink-0 flex-col gap-2 border-b py-4 pl-6 pr-4\",\n\t\t\t\"has-[.icon-button]:pr-4\", // when there are actions in the header, shorten the padding\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n);\n\n/**\n * The footer container for a sheet. This is where you would typically place close and submit buttons.\n * Should be rendered as a child of `SheetContent`.\n */\nconst SheetFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\"border-dialog-muted flex shrink-0 justify-end gap-2 border-t px-6 py-2.5\", className)}\n\t\t{...props}\n\t/>\n);\n\n/**\n * The title for a sheet. Typically rendered as a child of `SheetTitleGroup`.\n * Defaults to an `h2` element, but can be changed via the `asChild` prop.\n */\nconst SheetTitle = forwardRef<\n\tElementRef<typeof SheetPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<SheetPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\"text-strong flex-1 truncate text-lg font-medium\", className)}\n\t\t{...props}\n\t/>\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\n\n/**\n * A group container for the title and actions of a sheet. Typically rendered as a child of `SheetHeader`.\n */\nconst SheetTitleGroup = forwardRef<ElementRef<\"div\">, HTMLAttributes<HTMLDivElement>>(\n\t({ children, className, ...props }, ref) => (\n\t\t<div className={cx(\"flex items-center justify-between gap-2\", className)} {...props} ref={ref}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nSheetTitleGroup.displayName = \"SheetTitleGroup\";\n\n/**\n * A description for a sheet. Typically rendered as a child of `SheetHeader`.\n */\nconst SheetDescription = forwardRef<\n\tElementRef<typeof SheetPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<SheetPrimitive.Description ref={ref} className={cx(\"text-body text-sm\", className)} {...props} />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\n/**\n * A group container for the actions of a sheet. Typically rendered as a child of `SheetTitleGroup`.\n */\nconst SheetActions = forwardRef<ElementRef<\"div\">, HTMLAttributes<HTMLDivElement>>(\n\t({ children, className, ...props }, ref) => (\n\t\t<div className={cx(\"flex h-full items-center gap-2\", className)} {...props} ref={ref}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nSheetActions.displayName = \"SheetActions\";\n\nexport {\n\tSheet,\n\tSheetActions,\n\tSheetBody,\n\tSheetClose,\n\tSheetCloseIconButton,\n\tSheetContent,\n\tSheetDescription,\n\tSheetFooter,\n\tSheetHeader,\n\tSheetOverlay,\n\tSheetPortal,\n\tSheetTitle,\n\tSheetTitleGroup,\n\tSheetTrigger,\n};\n"],"mappings":"uNAAA,OAAS,KAAAA,MAAS,0BAClB,UAAYC,MAAoB,yBAChC,OAAS,OAAAC,MAA8B,2BACvC,OAAS,cAAAC,MAAkB,QAwC1B,cAAAC,EAuCC,QAAAC,MAvCD,oBA/BD,IAAMC,EAAuB,OAMvBC,EAA8B,UAM9BC,EAA4B,QAQ5BC,EAA6B,SAO7BC,EAAeC,EAGnB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EA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B,EAAapB,EAGjB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAgB,QAAf,CACA,IAAKU,EACL,UAAWC,EAAG,kDAAmDH,CAAS,EACzE,GAAGC,EACL,CACA,EACDkB,EAAW,YAA6B,QAAM,YAK9C,IAAMC,EAAkBrB,EACvB,CAAC,CAAE,SAAAS,EAAU,UAAAR,EAAW,GAAGC,CAAM,EAAGC,IACnCV,EAAC,OAAI,UAAWW,EAAG,0CAA2CH,CAAS,EAAI,GAAGC,EAAO,IAAKC,EACxF,SAAAM,EACF,CAEF,EACAY,EAAgB,YAAc,kBAK9B,IAAMC,EAAmBtB,EAGvB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAgB,cAAf,CAA2B,IAAKU,EAAK,UAAWC,EAAG,oBAAqBH,CAAS,EAAI,GAAGC,EAAO,CAChG,EACDoB,EAAiB,YAA6B,cAAY,YAK1D,IAAMC,EAAevB,EACpB,CAAC,CAAE,SAAAS,EAAU,UAAAR,EAAW,GAAGC,CAAM,EAAGC,IACnCV,EAAC,OAAI,UAAWW,EAAG,iCAAkCH,CAAS,EAAI,GAAGC,EAAO,IAAKC,EAC/E,SAAAM,EACF,CAEF,EACAc,EAAa,YAAc","names":["X","SheetPrimitive","cva","forwardRef","jsx","jsxs","Sheet","SheetTrigger","SheetClose","SheetPortal","SheetOverlay","forwardRef","className","props","ref","cx","SheetVariants","cva","SheetContent","side","children","SheetCloseIconButton","size","type","label","appearance","IconButton","X","SheetBody","SheetHeader","SheetFooter","SheetTitle","SheetTitleGroup","SheetDescription","SheetActions"]}
1
+ {"version":3,"sources":["../src/components/sheet/sheet.tsx"],"sourcesContent":["import { X } from \"@phosphor-icons/react/X\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ComponentPropsWithoutRef, ElementRef, HTMLAttributes } from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { IconButton, type IconButtonProps } from \"../button/icon-button.js\";\nimport * as SheetPrimitive from \"../dialog/primitive.js\";\nimport { preventCloseOnPromptInteraction } from \"../toast/toast.js\";\n\n/**\n * The root component for a sheet. Should compose the `SheetTrigger` and `SheetContent`.\n * Acts as a stateful provider for the sheet's open/closed state.\n */\nconst Sheet = SheetPrimitive.Root;\n\n/**\n * The trigger for a sheet. Should be rendered as a child of the `Sheet` component.\n * Renders an unstyled button by default, but can be customized with the `asChild` prop.\n */\nconst SheetTrigger = SheetPrimitive.Trigger;\n\n/**\n * The close button for a sheet. Should be rendered as a child of the `SheetContent` component.\n * Renders an unstyled button by default, but can be customized with the `asChild` prop.\n */\nconst SheetClose = SheetPrimitive.Close;\n\n/**\n * The portal for a sheet. Should be rendered as a child of the `Sheet` component.\n * Renders a portal that the `SheetOverlay` and `SheetContent` is rendered into.\n *\n * You likely don't need to use this component directly, as it is used internally by the `SheetContent` component.\n */\nconst SheetPortal = SheetPrimitive.Portal;\n\n/**\n * The overlay backdrop for a sheet. Should be rendered as a child of the `SheetPortal` component.\n *\n * You likely don't need to use this component directly, as it is used internally by the `SheetContent` component.\n */\nconst SheetOverlay = forwardRef<\n\tElementRef<typeof SheetPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<SheetPrimitive.Overlay\n\t\tclassName={cx(\n\t\t\t\"bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-40 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t\tref={ref}\n\t/>\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nconst SheetVariants = cva(\n\t\"bg-dialog data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in fixed z-40 flex flex-col shadow-lg outline-none transition ease-in-out focus-within:outline-none\",\n\t{\n\t\tvariants: {\n\t\t\tside: {\n\t\t\t\ttop: \"border-dialog data-state-closed:slide-out-to-top data-state-open:slide-in-from-top inset-x-0 top-0 border-b\",\n\t\t\t\tbottom:\n\t\t\t\t\t\"border-dialog data-state-closed:slide-out-to-bottom data-state-open:slide-in-from-bottom inset-x-0 bottom-0 border-t\",\n\t\t\t\tleft: \"border-dialog data-state-closed:slide-out-to-left data-state-open:slide-in-from-left inset-y-0 left-0 h-full w-full border-r sm:max-w-[30rem]\",\n\t\t\t\tright:\n\t\t\t\t\t\"border-dialog data-state-closed:slide-out-to-right data-state-open:slide-in-from-right inset-y-0 right-0 h-full w-full border-l sm:max-w-[30rem]\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tside: \"right\",\n\t\t},\n\t},\n);\n\ntype SheetContentProps = {} & ComponentPropsWithoutRef<typeof SheetPrimitive.Content> &\n\tVariantProps<typeof SheetVariants>;\n\n/**\n * The main container for a sheet. Renders on top of the overlay backdrop.\n * Should compose the `SheetHeader`, `SheetBody`, and `SheetFooter`.\n */\nconst SheetContent = forwardRef<ElementRef<\"div\">, SheetContentProps>(\n\t({ children, className, onInteractOutside, onPointerDownOutside, side = \"right\", ...props }, ref) => (\n\t\t<SheetPortal>\n\t\t\t<SheetOverlay />\n\t\t\t<SheetPrimitive.Content\n\t\t\t\tclassName={cx(SheetVariants({ side }), className)}\n\t\t\t\tonInteractOutside={(event) => {\n\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\tonInteractOutside?.(event);\n\t\t\t\t}}\n\t\t\t\tonPointerDownOutside={(event) => {\n\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\tonPointerDownOutside?.(event);\n\t\t\t\t}}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</SheetPrimitive.Content>\n\t\t</SheetPortal>\n\t),\n);\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\ntype SheetCloseIconButtonProps = Partial<Omit<IconButtonProps, \"icon\">>;\n\n/**\n * An icon button that closes the sheet when clicked. Should be rendered within the `SheetHeader` as a child of `SheetActions`.\n */\nconst SheetCloseIconButton = ({\n\tsize = \"md\",\n\ttype = \"button\",\n\tlabel = \"Close Sheet\",\n\tappearance = \"ghost\",\n\t...props\n}: SheetCloseIconButtonProps) => (\n\t<SheetPrimitive.Close asChild>\n\t\t<IconButton appearance={appearance} icon={<X />} label={label} size={size} type={type} {...props} />\n\t</SheetPrimitive.Close>\n);\n\n/**\n * The body container for a sheet. This is where you would typically place the main content of the sheet.\n * Should be rendered as a child of `SheetContent`.\n */\nconst SheetBody = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"scrollbar text-body flex-1 overflow-y-auto p-6\", className)} {...props} />\n);\n\n/**\n * The header container for a sheet. This is where you would typically place the title, description, and actions.\n * Should be rendered as a child of `SheetContent`.\n */\nconst SheetHeader = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\n\t\t\t\"border-dialog-muted flex shrink-0 flex-col gap-2 border-b py-4 pl-6 pr-4\",\n\t\t\t\"has-[.icon-button]:pr-4\", // when there are actions in the header, shorten the padding\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n);\n\n/**\n * The footer container for a sheet. This is where you would typically place close and submit buttons.\n * Should be rendered as a child of `SheetContent`.\n */\nconst SheetFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\"border-dialog-muted flex shrink-0 justify-end gap-2 border-t px-6 py-2.5\", className)}\n\t\t{...props}\n\t/>\n);\n\n/**\n * The title for a sheet. Typically rendered as a child of `SheetTitleGroup`.\n * Defaults to an `h2` element, but can be changed via the `asChild` prop.\n */\nconst SheetTitle = forwardRef<\n\tElementRef<typeof SheetPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<SheetPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\"text-strong flex-1 truncate text-lg font-medium\", className)}\n\t\t{...props}\n\t/>\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\n\n/**\n * A group container for the title and actions of a sheet. Typically rendered as a child of `SheetHeader`.\n */\nconst SheetTitleGroup = forwardRef<ElementRef<\"div\">, HTMLAttributes<HTMLDivElement>>(\n\t({ children, className, ...props }, ref) => (\n\t\t<div className={cx(\"flex items-center justify-between gap-2\", className)} {...props} ref={ref}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nSheetTitleGroup.displayName = \"SheetTitleGroup\";\n\n/**\n * A description for a sheet. Typically rendered as a child of `SheetHeader`.\n */\nconst SheetDescription = forwardRef<\n\tElementRef<typeof SheetPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<SheetPrimitive.Description ref={ref} className={cx(\"text-body text-sm\", className)} {...props} />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\n/**\n * A group container for the actions of a sheet. Typically rendered as a child of `SheetTitleGroup`.\n */\nconst SheetActions = forwardRef<ElementRef<\"div\">, HTMLAttributes<HTMLDivElement>>(\n\t({ children, className, ...props }, ref) => (\n\t\t<div className={cx(\"flex h-full items-center gap-2\", className)} {...props} ref={ref}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nSheetActions.displayName = \"SheetActions\";\n\nexport {\n\tSheet,\n\tSheetActions,\n\tSheetBody,\n\tSheetClose,\n\tSheetCloseIconButton,\n\tSheetContent,\n\tSheetDescription,\n\tSheetFooter,\n\tSheetHeader,\n\tSheetOverlay,\n\tSheetPortal,\n\tSheetTitle,\n\tSheetTitleGroup,\n\tSheetTrigger,\n};\n"],"mappings":"qZAAA,OAAS,KAAAA,MAAS,0BAClB,OAAS,OAAAC,MAA8B,2BAEvC,OAAS,cAAAC,MAAkB,QAyC1B,cAAAC,EAuCC,QAAAC,MAvCD,oBA/BD,IAAMC,EAAuBC,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ef","className","props","ref","Overlay","cx","SheetVariants","cva","SheetContent","children","onInteractOutside","onPointerDownOutside","side","Content","event","preventCloseOnPromptInteraction","SheetCloseIconButton","size","type","label","appearance","IconButton","X","SheetBody","SheetHeader","SheetFooter","SheetTitle","Title","SheetTitleGroup","SheetDescription","Description","SheetActions"]}
@@ -0,0 +1,26 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { S as SvgAttributes } from './types-BuKAGhC-.js';
4
+
5
+ type SvgOnlyProps = Omit<SvgAttributes, "children"> & {
6
+ /**
7
+ * A single SVG icon element.
8
+ */
9
+ svg: ReactNode;
10
+ };
11
+ /**
12
+ * Accepts a single SVG icon element and decorates it with `shrink-0` class.
13
+ *
14
+ * Merges `className` selectors with the following order of precedence (last one wins):
15
+ * 1. SvgOnly base classes ("shrink-0")
16
+ * 2. SvgOnly className
17
+ * 3. svg className
18
+ *
19
+ * You probably want to use the `Icon` component instead.
20
+ *
21
+ * The main difference between `Icon` and `SvgOnly` is that `SvgOnly` does not
22
+ * apply any default sizing styles, only `shrink-0`.
23
+ */
24
+ declare const SvgOnly: react.ForwardRefExoticComponent<Omit<SvgOnlyProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
25
+
26
+ export { SvgOnly as S, type SvgOnlyProps as a };
@@ -33,7 +33,7 @@ type Theme = (typeof themes)[number];
33
33
  /**
34
34
  * $theme is a helper which translates the Theme type into a string literal type.
35
35
  */
36
- declare const $theme: <T extends Theme = "light" | "dark" | "light-high-contrast" | "dark-high-contrast" | "system">(value: T) => T;
36
+ declare const $theme: <T extends Theme = "dark" | "light" | "light-high-contrast" | "dark-high-contrast" | "system">(value: T) => T;
37
37
  /**
38
38
  * Type predicate that checks if a value is a valid theme.
39
39
  */
@@ -41,7 +41,7 @@ declare function isTheme(value: unknown): value is Theme;
41
41
  /**
42
42
  * $resolvedTheme is a helper which translates the ResolvedTheme type into a string literal type.
43
43
  */
44
- declare const $resolvedTheme: <T extends ResolvedTheme = "light" | "dark" | "light-high-contrast" | "dark-high-contrast">(value: T) => T;
44
+ declare const $resolvedTheme: <T extends ResolvedTheme = "dark" | "light" | "light-high-contrast" | "dark-high-contrast">(value: T) => T;
45
45
  /**
46
46
  * Type predicate that checks if a value is a valid resolved theme.
47
47
  */
@@ -72,14 +72,14 @@ declare function applyTheme(theme: Theme): void;
72
72
  * Read the theme and applied theme from the `<html>` element.
73
73
  */
74
74
  declare function readThemeFromHtmlElement(): {
75
- appliedTheme: "light" | "dark" | "light-high-contrast" | "dark-high-contrast" | undefined;
76
- theme: "light" | "dark" | "light-high-contrast" | "dark-high-contrast" | "system" | undefined;
75
+ appliedTheme: "dark" | "light" | "light-high-contrast" | "dark-high-contrast" | undefined;
76
+ theme: "dark" | "light" | "light-high-contrast" | "dark-high-contrast" | "system" | undefined;
77
77
  };
78
78
  /**
79
79
  * If the theme is "system", it will resolve the theme based on the user's media query preferences, otherwise it will return the theme as is.
80
80
  * This will mirror the result that gets applied to the <html> element.
81
81
  */
82
- declare function useAppliedTheme(): "light" | "dark" | "light-high-contrast" | "dark-high-contrast";
82
+ declare function useAppliedTheme(): "dark" | "light" | "light-high-contrast" | "dark-high-contrast";
83
83
  declare function preventWrongThemeFlashScriptContent({ defaultTheme, storageKey, }: {
84
84
  defaultTheme?: Theme;
85
85
  storageKey?: string;
@@ -1,34 +1,2 @@
1
- import{a as g}from"./chunk-D3XF6J5A.js";import E from"clsx";import{createContext as N,useContext as W,useEffect as x,useMemo as C,useState as B}from"react";import _ from"tiny-invariant";import{Fragment as k,jsx as a,jsxs as b}from"react/jsx-runtime";var M="https://assets.ngrok.com",q=`${M}/fonts`,R=["/euclid-square/EuclidSquare-Regular-WebS.woff","/euclid-square/EuclidSquare-RegularItalic-WebS.woff","/euclid-square/EuclidSquare-Medium-WebS.woff","/euclid-square/EuclidSquare-Semibold-WebS.woff","/euclid-square/EuclidSquare-MediumItalic-WebS.woff","/ibm-plex-mono/IBMPlexMono-Text.woff","/ibm-plex-mono/IBMPlexMono-TextItalic.woff","/ibm-plex-mono/IBMPlexMono-SemiBold.woff","/ibm-plex-mono/IBMPlexMono-SemiBoldItalic.woff"],D=e=>`${q}${e}`,y=({includeNunitoSans:e=!1})=>b(k,{children:[a("link",{rel:"preconnect",href:M}),R.map(t=>a("link",{rel:"preload",href:D(t),as:"font",type:"font/woff",crossOrigin:"anonymous"},t)),e&&a(L,{})]});function L(){return b(k,{children:[a("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),a("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),a("link",{href:"https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap",rel:"stylesheet"})]})}import{Fragment as X,jsx as w,jsxs as Z}from"react/jsx-runtime";var h="(prefers-color-scheme: dark)",l="(prefers-contrast: more)",v=["light","dark","light-high-contrast","dark-high-contrast"],p=["system",...v],O=e=>e;function S(e){return typeof e!="string"?!1:p.includes(e)}var A=e=>e;function H(e){return typeof e!="string"?!1:v.includes(e)}var f="mantle-ui-theme",Q=["system",()=>null],I=N(Q),u=()=>typeof window<"u";function c(e,t="system"){let o=t??"system";if(u()){let s=null;try{s="localStorage"in window?window.localStorage.getItem(e):null}catch{}return S(s)?s:o}return o}function z({children:e,defaultTheme:t="system",storageKey:o=f}){let[s,r]=B(()=>{let n=c(o,t);return i(n),n});x(()=>{let n=c(o,t);r(n),i(n)},[t,o]),x(()=>{let n=window.matchMedia(h),m=window.matchMedia(l),d=()=>{c(o,t)==="system"&&i("system")};return n.addEventListener("change",d),m.addEventListener("change",d),()=>{n.removeEventListener("change",d),m.removeEventListener("change",d)}},[t,o]);let T=C(()=>[s,n=>{try{"localStorage"in window&&window.localStorage.setItem(o,n)}catch{}r(n),i(n)}],[o,s]);return w(I.Provider,{value:T,children:e})}function F(){let e=W(I);return _(e,"useTheme must be used within a ThemeProvider"),e}function i(e){if(!u())return;let t=window.document.documentElement;t.classList.remove(...p);let o=window.matchMedia(h).matches,s=window.matchMedia(l).matches,r=P(e,{prefersDarkMode:o,prefersHighContrast:s});t.classList.add(r),t.dataset.appliedTheme=r,t.dataset.theme=e}function G(){if(!u())return{appliedTheme:void 0,theme:void 0};let e=window.document.documentElement,t=S(e.dataset.theme)?e.dataset.theme:void 0;return{appliedTheme:H(e.dataset.appliedTheme)?e.dataset.appliedTheme:void 0,theme:t}}function P(e,{prefersDarkMode:t,prefersHighContrast:o}){return e==="system"?U({prefersDarkMode:t,prefersHighContrast:o}):e}function J(){let[e]=F(),t=g(h),o=g(l);return P(e,{prefersDarkMode:t,prefersHighContrast:o})}function U({prefersDarkMode:e,prefersHighContrast:t}){return t?e?"dark-high-contrast":"light-high-contrast":e?"dark":"light"}function $({defaultTheme:e="system",storageKey:t=f}){return`
2
- (function() {
3
- const themes = ${JSON.stringify(p)};
4
- const isTheme = (value) => typeof value === "string" && themes.includes(value);
5
- const fallbackTheme = "${e}" ?? "system";
6
- let maybeStoredTheme = null;
7
- try {
8
- maybeStoredTheme = "localStorage" in window ? window.localStorage.getItem("${t}") : null;
9
- } catch (_) {}
10
- const hasStoredTheme = isTheme(maybeStoredTheme);
11
- if (!hasStoredTheme && "localStorage" in window) {
12
- try {
13
- window.localStorage.setItem("${t}", fallbackTheme);
14
- } catch (_) {}
15
- }
16
- const themePreference = hasStoredTheme ? maybeStoredTheme : fallbackTheme;
17
- const prefersDarkMode = window.matchMedia("${h}").matches;
18
- const prefersHighContrast = window.matchMedia("${l}").matches;
19
- let initialTheme = themePreference;
20
- if (initialTheme === "system") {
21
- if (prefersHighContrast) {
22
- initialTheme = prefersDarkMode ? "dark-high-contrast" : "light-high-contrast";
23
- } else {
24
- initialTheme = prefersDarkMode ? "dark" : "light";
25
- }
26
- }
27
- const htmlElement = document.documentElement;
28
- htmlElement.classList.remove(...themes);
29
- htmlElement.classList.add(initialTheme);
30
- htmlElement.dataset.appliedTheme = initialTheme;
31
- htmlElement.dataset.theme = themePreference;
32
- })();
33
- `.trim()}var Y=({defaultTheme:e="system",storageKey:t=f,includeNunitoSans:o=!1})=>Z(X,{children:[w("script",{dangerouslySetInnerHTML:{__html:$({defaultTheme:e,storageKey:t})}}),w(y,{includeNunitoSans:o})]});function V(e){let{className:t="",defaultTheme:o="system",storageKey:s=f}=e??{};return C(()=>{if(!u())return{className:E(t),"data-applied-theme":"system","data-theme":"system"};let r=window.matchMedia(h).matches,T=window.matchMedia(l).matches,n=c(s,o),m=P(n,{prefersDarkMode:r,prefersHighContrast:T});return{className:E(t,m),"data-applied-theme":m,"data-theme":n}},[t,o,s])}export{A as $resolvedTheme,O as $theme,Y as MantleThemeHeadContent,y as PreloadFonts,z as ThemeProvider,i as applyTheme,H as isResolvedTheme,S as isTheme,$ as preventWrongThemeFlashScriptContent,G as readThemeFromHtmlElement,v as resolvedThemes,p as themes,J as useAppliedTheme,V as useInitialHtmlThemeProps,F as useTheme};
1
+ import{a as e,b as m,c as r,d as o,e as t,f as h,g as s,h as T,i as p,j as l,k as d,l as n,m as i,n as a,o as v}from"./chunk-273VK4KO.js";import"./chunk-D3XF6J5A.js";export{h as $resolvedTheme,o as $theme,a as MantleThemeHeadContent,e as PreloadFonts,T as ThemeProvider,l as applyTheme,s as isResolvedTheme,t as isTheme,i as preventWrongThemeFlashScriptContent,d as readThemeFromHtmlElement,m as resolvedThemes,r as themes,n as useAppliedTheme,v as useInitialHtmlThemeProps,p as useTheme};
34
2
  //# sourceMappingURL=theme-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/theme-provider/theme-provider.tsx","../src/components/theme-provider/preload-fonts.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport type { ComponentProps, PropsWithChildren } from \"react\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { useMatchesMediaQuery } from \"../../hooks/use-matches-media-query.js\";\nimport { PreloadFonts } from \"./preload-fonts.js\";\n\n/**\n * prefersDarkModeMediaQuery is the media query used to detect if the user prefers dark mode.\n */\nconst prefersDarkModeMediaQuery = \"(prefers-color-scheme: dark)\";\n\n/**\n * prefersHighContrastMediaQuery is the media query used to detect if the user prefers high contrast mode.\n */\nconst prefersHighContrastMediaQuery = \"(prefers-contrast: more)\";\n\n/**\n * resolvedThemes is a tuple of valid themes that have been resolved from \"system\" to a specific theme.\n */\nconst resolvedThemes = [\"light\", \"dark\", \"light-high-contrast\", \"dark-high-contrast\"] as const;\n\n/**\n * ResolvedTheme is a type that represents a theme that has been resolved from \"system\" to a specific theme.\n */\ntype ResolvedTheme = (typeof resolvedThemes)[number];\n\n/**\n * themes is a tuple of valid themes.\n */\nconst themes = [\"system\", ...resolvedThemes] as const;\n\n/**\n * Theme is a string literal type that represents a valid theme.\n */\ntype Theme = (typeof themes)[number];\n\n/**\n * $theme is a helper which translates the Theme type into a string literal type.\n */\nconst $theme = <T extends Theme = Theme>(value: T) => value;\n\n/**\n * Type predicate that checks if a value is a valid theme.\n */\nfunction isTheme(value: unknown): value is Theme {\n\tif (typeof value !== \"string\") {\n\t\treturn false;\n\t}\n\n\treturn themes.includes(value as Theme);\n}\n\n/**\n * $resolvedTheme is a helper which translates the ResolvedTheme type into a string literal type.\n */\nconst $resolvedTheme = <T extends ResolvedTheme = ResolvedTheme>(value: T) => value;\n\n/**\n * Type predicate that checks if a value is a valid resolved theme.\n */\nfunction isResolvedTheme(value: unknown): value is ResolvedTheme {\n\tif (typeof value !== \"string\") {\n\t\treturn false;\n\t}\n\n\treturn resolvedThemes.includes(value as ResolvedTheme);\n}\n\n/**\n * DEFAULT_STORAGE_KEY is the default key used to store the theme in localStorage.\n */\nconst DEFAULT_STORAGE_KEY = \"mantle-ui-theme\";\n\n/**\n * ThemeProviderState is the shape of the state returned by the ThemeProviderContext.\n */\ntype ThemeProviderState = [theme: Theme, setTheme: (theme: Theme) => void];\n\n/**\n * Initial state for the ThemeProviderContext.\n */\nconst initialState: ThemeProviderState = [\"system\", () => null];\n\n/**\n * ThemeProviderContext is a React Context that provides the current theme and a function to set the theme.\n */\nconst ThemeProviderContext = createContext<ThemeProviderState>(initialState);\n\n/**\n * isBrowser returns true if the code is running in a browser environment.\n */\nconst isBrowser = () => typeof window !== \"undefined\";\n\n/**\n * Gets the stored theme from localStorage or returns the default theme if no theme is stored.\n */\nfunction getStoredTheme(storageKey: string, defaultTheme: Theme = \"system\") {\n\tconst fallbackTheme = defaultTheme ?? \"system\";\n\tif (isBrowser()) {\n\t\tlet storedTheme: string | null = null;\n\t\ttry {\n\t\t\tstoredTheme = \"localStorage\" in window ? window.localStorage.getItem(storageKey) : null;\n\t\t} catch (_) {}\n\t\treturn isTheme(storedTheme) ? storedTheme : fallbackTheme;\n\t}\n\treturn fallbackTheme;\n}\n\ntype ThemeProviderProps = PropsWithChildren & {\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n};\n\n/**\n * ThemeProvider is a React Context Provider that provides the current theme and a function to set the theme.\n */\nfunction ThemeProvider({ children, defaultTheme = \"system\", storageKey = DEFAULT_STORAGE_KEY }: ThemeProviderProps) {\n\tconst [theme, setTheme] = useState<Theme>(() => {\n\t\tconst initialTheme = getStoredTheme(storageKey, defaultTheme);\n\t\tapplyTheme(initialTheme);\n\t\treturn initialTheme;\n\t});\n\n\tuseEffect(() => {\n\t\tconst storedTheme = getStoredTheme(storageKey, defaultTheme);\n\t\tsetTheme(storedTheme);\n\t\tapplyTheme(storedTheme);\n\t}, [defaultTheme, storageKey]);\n\n\tuseEffect(() => {\n\t\tconst prefersDarkMql = window.matchMedia(prefersDarkModeMediaQuery);\n\t\tconst prefersHighContrastMql = window.matchMedia(prefersHighContrastMediaQuery);\n\n\t\tconst onChange = () => {\n\t\t\tconst storedTheme = getStoredTheme(storageKey, defaultTheme);\n\n\t\t\t// If the stored theme is not \"system\", then the user has explicitly set a theme and we should not\n\t\t\t// automatically change the theme when the user's system preferences change.\n\t\t\tif (storedTheme !== \"system\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tapplyTheme(\"system\");\n\t\t};\n\n\t\tprefersDarkMql.addEventListener(\"change\", onChange);\n\t\tprefersHighContrastMql.addEventListener(\"change\", onChange);\n\n\t\treturn () => {\n\t\t\tprefersDarkMql.removeEventListener(\"change\", onChange);\n\t\t\tprefersHighContrastMql.removeEventListener(\"change\", onChange);\n\t\t};\n\t}, [defaultTheme, storageKey]);\n\n\tconst value: ThemeProviderState = useMemo(\n\t\t() => [\n\t\t\ttheme,\n\t\t\t(theme: Theme) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (\"localStorage\" in window) {\n\t\t\t\t\t\twindow.localStorage.setItem(storageKey, theme);\n\t\t\t\t\t}\n\t\t\t\t} catch (_) {}\n\t\t\t\tsetTheme(theme);\n\t\t\t\tapplyTheme(theme);\n\t\t\t},\n\t\t],\n\t\t[storageKey, theme],\n\t);\n\n\treturn <ThemeProviderContext.Provider value={value}>{children}</ThemeProviderContext.Provider>;\n}\n\n/**\n * useTheme returns the current theme and a function to set the theme.\n *\n * @note This function will throw an error if used outside of a ThemeProvider context tree.\n */\nfunction useTheme() {\n\tconst context = useContext(ThemeProviderContext);\n\n\tinvariant(context, \"useTheme must be used within a ThemeProvider\");\n\n\treturn context;\n}\n\n/**\n * Applies the given theme to the `<html>` element.\n */\nfunction applyTheme(theme: Theme) {\n\tif (!isBrowser()) {\n\t\treturn;\n\t}\n\n\tconst htmlElement = window.document.documentElement;\n\thtmlElement.classList.remove(...themes);\n\tconst prefersDarkMode = window.matchMedia(prefersDarkModeMediaQuery).matches;\n\tconst prefersHighContrast = window.matchMedia(prefersHighContrastMediaQuery).matches;\n\tconst newTheme = resolveTheme(theme, { prefersDarkMode, prefersHighContrast });\n\thtmlElement.classList.add(newTheme);\n\thtmlElement.dataset.appliedTheme = newTheme;\n\thtmlElement.dataset.theme = theme;\n}\n\n/**\n * Read the theme and applied theme from the `<html>` element.\n */\nfunction readThemeFromHtmlElement() {\n\tif (!isBrowser()) {\n\t\treturn {\n\t\t\tappliedTheme: undefined,\n\t\t\ttheme: undefined,\n\t\t};\n\t}\n\n\tconst htmlElement = window.document.documentElement;\n\tconst theme = isTheme(htmlElement.dataset.theme) ? htmlElement.dataset.theme : undefined;\n\tconst appliedTheme = isResolvedTheme(htmlElement.dataset.appliedTheme) ? htmlElement.dataset.appliedTheme : undefined;\n\n\treturn {\n\t\tappliedTheme,\n\t\ttheme,\n\t};\n}\n\n/**\n * If the theme is \"system\", it will resolve the theme based on the user's media query preferences, otherwise it will return the theme as is.\n * This will mirror the result that gets applied to the <html> element.\n */\nfunction resolveTheme(\n\ttheme: Theme,\n\t{ prefersDarkMode, prefersHighContrast }: { prefersDarkMode: boolean; prefersHighContrast: boolean },\n) {\n\tif (theme === \"system\") {\n\t\treturn determineThemeFromMediaQuery({ prefersDarkMode, prefersHighContrast });\n\t}\n\n\treturn theme;\n}\n\n/**\n * If the theme is \"system\", it will resolve the theme based on the user's media query preferences, otherwise it will return the theme as is.\n * This will mirror the result that gets applied to the <html> element.\n */\nfunction useAppliedTheme() {\n\tconst [theme] = useTheme();\n\n\tconst prefersDarkMode = useMatchesMediaQuery(prefersDarkModeMediaQuery);\n\tconst prefersHighContrast = useMatchesMediaQuery(prefersHighContrastMediaQuery);\n\n\treturn resolveTheme(theme, { prefersDarkMode, prefersHighContrast });\n}\n\n/**\n * determineThemeFromMediaQuery returns the theme that should be used based on the user's media query preferences.\n * @private\n */\nexport function determineThemeFromMediaQuery({\n\tprefersDarkMode,\n\tprefersHighContrast,\n}: {\n\tprefersDarkMode: boolean;\n\tprefersHighContrast: boolean;\n}): ResolvedTheme {\n\tif (prefersHighContrast) {\n\t\treturn prefersDarkMode ? \"dark-high-contrast\" : \"light-high-contrast\";\n\t}\n\n\treturn prefersDarkMode ? \"dark\" : \"light\";\n}\n\nfunction preventWrongThemeFlashScriptContent({\n\tdefaultTheme = \"system\",\n\tstorageKey = DEFAULT_STORAGE_KEY,\n}: {\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n}) {\n\treturn `\n(function() {\n\tconst themes = ${JSON.stringify(themes)};\n\tconst isTheme = (value) => typeof value === \"string\" && themes.includes(value);\n\tconst fallbackTheme = \"${defaultTheme}\" ?? \"system\";\n\tlet maybeStoredTheme = null;\n\ttry {\n\t\tmaybeStoredTheme = \"localStorage\" in window ? window.localStorage.getItem(\"${storageKey}\") : null;\n\t} catch (_) {}\n\tconst hasStoredTheme = isTheme(maybeStoredTheme);\n\tif (!hasStoredTheme && \"localStorage\" in window) {\n\t\ttry {\n\t\t\twindow.localStorage.setItem(\"${storageKey}\", fallbackTheme);\n\t\t} catch (_) {}\n\t}\n\tconst themePreference = hasStoredTheme ? maybeStoredTheme : fallbackTheme;\n\tconst prefersDarkMode = window.matchMedia(\"${prefersDarkModeMediaQuery}\").matches;\n\tconst prefersHighContrast = window.matchMedia(\"${prefersHighContrastMediaQuery}\").matches;\n\tlet initialTheme = themePreference;\n\tif (initialTheme === \"system\") {\n\t\tif (prefersHighContrast) {\n\t\t\tinitialTheme = prefersDarkMode ? \"dark-high-contrast\" : \"light-high-contrast\";\n\t\t} else {\n\t\t\tinitialTheme = prefersDarkMode ? \"dark\" : \"light\";\n\t\t}\n\t}\n\tconst htmlElement = document.documentElement;\n\thtmlElement.classList.remove(...themes);\n\thtmlElement.classList.add(initialTheme);\n\thtmlElement.dataset.appliedTheme = initialTheme;\n\thtmlElement.dataset.theme = themePreference;\n})();\n`.trim();\n}\n\ntype MantleThemeHeadContentProps = {\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n} & ComponentProps<typeof PreloadFonts>;\n\n/**\n * MantleThemeHeadContent is a React component that prevents the wrong theme from flashing on initial page load.\n * Render as high as possible in the <head> element.\n */\nconst MantleThemeHeadContent = ({\n\tdefaultTheme = \"system\",\n\tstorageKey = DEFAULT_STORAGE_KEY,\n\tincludeNunitoSans = false,\n}: MantleThemeHeadContentProps) => (\n\t<>\n\t\t<script\n\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t__html: preventWrongThemeFlashScriptContent({ defaultTheme, storageKey }),\n\t\t\t}}\n\t\t/>\n\t\t<PreloadFonts includeNunitoSans={includeNunitoSans} />\n\t</>\n);\n\ntype InitialThemeProps = {\n\tclassName: string;\n\t\"data-applied-theme\": Omit<Theme, \"system\">;\n\t\"data-theme\": Theme;\n};\n\n/**\n * useInitialHtmlThemeProps returns the initial props that should be applied to the <html> element to prevent react hydration errors.\n */\nfunction useInitialHtmlThemeProps(props?: {\n\tclassName?: string;\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n}): InitialThemeProps {\n\tconst { className = \"\", defaultTheme = \"system\", storageKey = DEFAULT_STORAGE_KEY } = props ?? {};\n\n\treturn useMemo(() => {\n\t\tif (!isBrowser()) {\n\t\t\treturn {\n\t\t\t\tclassName: clsx(className),\n\t\t\t\t\"data-applied-theme\": \"system\",\n\t\t\t\t\"data-theme\": \"system\",\n\t\t\t};\n\t\t}\n\n\t\tconst prefersDarkMode = window.matchMedia(prefersDarkModeMediaQuery).matches;\n\t\tconst prefersHighContrast = window.matchMedia(prefersHighContrastMediaQuery).matches;\n\t\tconst initialTheme = getStoredTheme(storageKey, defaultTheme);\n\t\tconst reolvedTheme = resolveTheme(initialTheme, { prefersDarkMode, prefersHighContrast });\n\n\t\treturn {\n\t\t\tclassName: clsx(className, reolvedTheme),\n\t\t\t\"data-applied-theme\": reolvedTheme,\n\t\t\t\"data-theme\": initialTheme,\n\t\t};\n\t}, [className, defaultTheme, storageKey]);\n}\n\nexport {\n\t//,\n\t$resolvedTheme,\n\t$theme,\n\tapplyTheme,\n\tisResolvedTheme,\n\tisTheme,\n\tMantleThemeHeadContent,\n\tpreventWrongThemeFlashScriptContent,\n\treadThemeFromHtmlElement,\n\tresolvedThemes,\n\tThemeProvider,\n\tthemes,\n\tuseAppliedTheme,\n\tuseInitialHtmlThemeProps,\n\tuseTheme,\n};\n\nexport type {\n\t//,\n\tResolvedTheme,\n\tTheme,\n\tThemeProviderProps,\n};\n","const cdnOrigin = \"https://assets.ngrok.com\";\nconst cdnBase = `${cdnOrigin}/fonts`;\n\nconst fonts = [\n\t\"/euclid-square/EuclidSquare-Regular-WebS.woff\",\n\t\"/euclid-square/EuclidSquare-RegularItalic-WebS.woff\",\n\t\"/euclid-square/EuclidSquare-Medium-WebS.woff\",\n\t\"/euclid-square/EuclidSquare-Semibold-WebS.woff\",\n\t\"/euclid-square/EuclidSquare-MediumItalic-WebS.woff\",\n\t\"/ibm-plex-mono/IBMPlexMono-Text.woff\",\n\t\"/ibm-plex-mono/IBMPlexMono-TextItalic.woff\",\n\t\"/ibm-plex-mono/IBMPlexMono-SemiBold.woff\",\n\t\"/ibm-plex-mono/IBMPlexMono-SemiBoldItalic.woff\",\n] as const;\n\ntype Font = (typeof fonts)[number];\n\nconst fontHref = <T extends Font = Font>(font: T) => `${cdnBase}${font}` as const;\n\ntype Props = {\n\t/**\n\t * If set, will also preload and include the optional Nunito Sans font from Google Fonts.\n\t * @default false\n\t */\n\tincludeNunitoSans?: boolean;\n};\n\n/**\n * Preload custom fonts used in the theme. This should be added to the head of the document in your application, preferably as high as possible.\n * Normally you won't use this directly, but instead use the `MantleThemeHeadContent` component which includes this.\n */\nconst PreloadFonts = ({ includeNunitoSans = false }: Props) => (\n\t<>\n\t\t<link rel=\"preconnect\" href={cdnOrigin} />\n\t\t{fonts.map((font) => (\n\t\t\t<link key={font} rel=\"preload\" href={fontHref(font)} as=\"font\" type=\"font/woff\" crossOrigin=\"anonymous\" />\n\t\t))}\n\t\t{includeNunitoSans && <NunitoSans />}\n\t</>\n);\n\nexport {\n\t//,\n\tPreloadFonts,\n};\n\nfunction NunitoSans() {\n\treturn (\n\t\t<>\n\t\t\t<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\" />\n\t\t\t<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossOrigin=\"anonymous\" />\n\t\t\t<link\n\t\t\t\thref=\"https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap\"\n\t\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AAS,EACzB,qBAAsB,SACtB,aAAc,QACf,EAGD,IAAMd,EAAkB,OAAO,WAAWpC,CAAyB,EAAE,QAC/DqC,EAAsB,OAAO,WAAWpC,CAA6B,EAAE,QACvEuB,EAAeV,EAAeC,EAAYC,CAAY,EACtDoC,EAAeb,EAAaf,EAAc,CAAE,gBAAAY,EAAiB,oBAAAC,CAAoB,CAAC,EAExF,MAAO,CACN,UAAWc,EAAKD,EAAWE,CAAY,EACvC,qBAAsBA,EACtB,aAAc5B,CACf,CACD,EAAG,CAAC0B,EAAWlC,EAAcD,CAAU,CAAC,CACzC","names":["clsx","createContext","useContext","useEffect","useMemo","useState","invariant","Fragment","jsx","jsxs","cdnOrigin","cdnBase","fonts","fontHref","font","PreloadFonts","includeNunitoSans","NunitoSans","NunitoSans","jsxs","Fragment","jsx","Fragment","jsx","jsxs","prefersDarkModeMediaQuery","prefersHighContrastMediaQuery","resolvedThemes","themes","$theme","value","isTheme","$resolvedTheme","isResolvedTheme","DEFAULT_STORAGE_KEY","initialState","ThemeProviderContext","createContext","isBrowser","getStoredTheme","storageKey","defaultTheme","fallbackTheme","storedTheme","ThemeProvider","children","theme","setTheme","useState","initialTheme","applyTheme","useEffect","prefersDarkMql","prefersHighContrastMql","onChange","useMemo","useTheme","context","useContext","invariant","htmlElement","prefersDarkMode","prefersHighContrast","newTheme","resolveTheme","readThemeFromHtmlElement","determineThemeFromMediaQuery","useAppliedTheme","useMatchesMediaQuery","preventWrongThemeFlashScriptContent","MantleThemeHeadContent","includeNunitoSans","PreloadFonts","useInitialHtmlThemeProps","props","className","clsx","reolvedTheme"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,69 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, ComponentProps } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import * as ToastPrimitive from 'sonner';
5
+ import { W as WithAsChild } from './as-child-Cvu56SuO.js';
6
+ import { W as WithStyleProps } from './with-style-props-VnLWm0Yd.js';
7
+ import { a as SvgOnlyProps } from './svg-only-CS2INnEL.js';
8
+ import './types-BuKAGhC-.js';
9
+
10
+ type ToasterPrimitiveProps = ComponentProps<typeof ToastPrimitive.Toaster>;
11
+ type ToasterProps = WithStyleProps & Pick<ToasterPrimitiveProps, "containerAriaLabel" | "dir" | "position"> & {
12
+ /**
13
+ * Time in milliseconds that should elapse before automatically dismissing toasts.
14
+ * When set here, this will be the default duration for all toasts.
15
+ * @default 4000
16
+ */
17
+ duration_ms?: number;
18
+ };
19
+ /**
20
+ * A container for displaying all toasts.
21
+ *
22
+ * Only one `<Toaster />` should be rendered in an app a time, preferably at the
23
+ * root level of the app.
24
+ */
25
+ declare const Toaster: ({ className, containerAriaLabel, dir, duration_ms, position, style, }: ToasterProps) => react_jsx_runtime.JSX.Element;
26
+ type MakeToastOptions = {
27
+ /**
28
+ * Time in milliseconds that should elapse before automatically closing the toast.
29
+ * Will default to the `<Toaster />`'s `duration_ms` if not provided.
30
+ */
31
+ duration_ms?: number;
32
+ /**
33
+ * An optional custom ID for this toast. If not given, a unique ID is provided for you.
34
+ */
35
+ id?: string;
36
+ };
37
+ /**
38
+ * Create a toast. Provide a `<Toast>` component as the `children` to be rendered
39
+ * inside the `<Toaster />` section.
40
+ */
41
+ declare function makeToast(children: ReactNode, options?: MakeToastOptions): string | number;
42
+ type ToastActionProps = ComponentProps<"button"> & WithAsChild;
43
+ declare const priorities: readonly ["danger", "info", "success", "warning"];
44
+ type Priority = (typeof priorities)[number];
45
+ type ToastProps = ComponentProps<"div"> & WithAsChild & {
46
+ priority: Priority;
47
+ };
48
+ /**
49
+ * A succinct message with a priority that is displayed temporarily.
50
+ * Toasts are used to provide feedback to the user without interrupting their workflow.
51
+ */
52
+ declare const Toast: react.ForwardRefExoticComponent<Omit<ToastProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
53
+ /**
54
+ * An icon that visually represents the priority of the toast.
55
+ * If you do not provide an icon, the default icon and color for the priority is used.
56
+ */
57
+ declare const ToastIcon: react.ForwardRefExoticComponent<Omit<Partial<SvgOnlyProps>, "ref"> & react.RefAttributes<SVGSVGElement>>;
58
+ /**
59
+ * A button that dismisses the toast when clicked.
60
+ * You can prevent the toast from being dismissed `onClick` by calling `event.preventDefault()`
61
+ */
62
+ declare const ToastAction: react.ForwardRefExoticComponent<Omit<ToastActionProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
63
+ type ToastMessageProps = ComponentProps<"p"> & WithAsChild;
64
+ /**
65
+ * The message content of the toast.
66
+ */
67
+ declare const ToastMessage: react.ForwardRefExoticComponent<Omit<ToastMessageProps, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
68
+
69
+ export { type Priority, Toast, ToastAction, ToastIcon, ToastMessage, Toaster, makeToast };
package/dist/toast.js ADDED
@@ -0,0 +1,2 @@
1
+ import{a as o,b as t,c as s,d as a,e,f as r}from"./chunk-CD26UMMG.js";import"./chunk-273VK4KO.js";import"./chunk-D3XF6J5A.js";import"./chunk-SMCZZUU4.js";import"./chunk-VJPVAY5J.js";import"./chunk-EW5CFGXT.js";export{s as Toast,e as ToastAction,a as ToastIcon,r as ToastMessage,o as Toaster,t as makeToast};
2
+ //# sourceMappingURL=toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "mantle is ngrok's UI library and design system.",
4
4
  "author": "ngrok",
5
5
  "license": "MIT",
6
- "version": "0.15.4",
6
+ "version": "0.16.0",
7
7
  "homepage": "https://mantle.ngrok.com",
8
8
  "repository": {
9
9
  "type": "git",
@@ -41,6 +41,7 @@
41
41
  "clsx": "2.1.1",
42
42
  "prismjs": "1.29.0",
43
43
  "react-day-picker": "8.10.1",
44
+ "sonner": "1.7.1",
44
45
  "tailwind-merge": "2.5.5",
45
46
  "tailwindcss-animate": "1.0.7",
46
47
  "tiny-invariant": "1.3.3"
@@ -265,6 +266,11 @@
265
266
  "import": "./dist/theme-provider.js",
266
267
  "types": "./dist/theme-provider.d.ts"
267
268
  },
269
+ "./toast": {
270
+ "@ngrok/mantle/source": "./src/components/toast/index.ts",
271
+ "import": "./dist/toast.js",
272
+ "types": "./dist/toast.d.ts"
273
+ },
268
274
  "./tooltip": {
269
275
  "@ngrok/mantle/source": "./src/components/tooltip/index.ts",
270
276
  "import": "./dist/tooltip.js",