@ngrok/mantle 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alert.js +1 -1
- package/dist/alert.js.map +1 -1
- package/dist/anchor.js +1 -1
- package/dist/anchor.js.map +1 -1
- package/dist/button.js +1 -1
- package/dist/card.js +1 -1
- package/dist/card.js.map +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/chunk-A5H52ODC.js +2 -0
- package/dist/chunk-A5H52ODC.js.map +1 -0
- package/dist/{chunk-REJRMQU5.js → chunk-C2ECUIPG.js} +2 -2
- package/dist/chunk-C2ECUIPG.js.map +1 -0
- package/dist/{chunk-Z7MU3U6D.js → chunk-IGCOSMVM.js} +1 -1
- package/dist/chunk-IGCOSMVM.js.map +1 -0
- package/dist/{chunk-6R4HKO6I.js → chunk-LFUD45DV.js} +2 -2
- package/dist/chunk-LFUD45DV.js.map +1 -0
- package/dist/{chunk-EX4RHD64.js → chunk-VT3Y7SNW.js} +2 -2
- package/dist/chunk-VT3Y7SNW.js.map +1 -0
- package/dist/code-block.js +1 -1
- package/dist/code-block.js.map +1 -1
- package/dist/cx.d.ts +10 -0
- package/dist/cx.js +2 -0
- package/dist/dialog.js +1 -1
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/{core.d.ts → hooks.d.ts} +1 -9
- package/dist/hooks.js +2 -0
- package/dist/hooks.js.map +1 -0
- package/dist/icon.js +1 -1
- package/dist/inline-code.js +1 -1
- package/dist/inline-code.js.map +1 -1
- package/dist/input.js +1 -1
- package/dist/input.js.map +1 -1
- package/dist/media-object.js +1 -1
- package/dist/media-object.js.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/popover.js.map +1 -1
- package/dist/select.js +1 -1
- package/dist/select.js.map +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sheet.js.map +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/table.js +1 -1
- package/dist/table.js.map +1 -1
- package/dist/text-area.js +1 -1
- package/dist/text-area.js.map +1 -1
- package/dist/theme-provider.js +1 -1
- package/dist/theme-provider.js.map +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.js.map +1 -1
- package/package.json +8 -4
- package/dist/chunk-6R4HKO6I.js.map +0 -1
- package/dist/chunk-EX4RHD64.js.map +0 -1
- package/dist/chunk-REJRMQU5.js.map +0 -1
- package/dist/chunk-Z4VZBWSY.js +0 -2
- package/dist/chunk-Z4VZBWSY.js.map +0 -1
- package/dist/chunk-Z7MU3U6D.js.map +0 -1
- package/dist/core.js +0 -2
- /package/dist/{core.js.map → cx.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/dropdown-menu/src/dropdown-menu.tsx"],"sourcesContent":["import * as Ariakit from \"@ariakit/react\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport type { ComponentPropsWithoutRef, ElementRef, HTMLAttributes } from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"../../
|
|
1
|
+
{"version":3,"sources":["../packages/dropdown-menu/src/dropdown-menu.tsx"],"sourcesContent":["import * as Ariakit from \"@ariakit/react\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport type { ComponentPropsWithoutRef, ElementRef, HTMLAttributes } from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"../../cx\";\nimport { Separator } from \"../../separator\";\nimport { WithAsChild } from \"../../types\";\n\nconst DropdownMenu = Ariakit.MenuProvider;\n\ntype DropdownMenuTriggerProps = Omit<ComponentPropsWithoutRef<typeof Ariakit.MenuButton>, \"render\"> & WithAsChild;\nconst DropdownMenuTrigger = forwardRef<ElementRef<\"button\">, DropdownMenuTriggerProps>(\n\t({ asChild = false, children, ...props }, ref) => {\n\t\tif (asChild) {\n\t\t\treturn (\n\t\t\t\t<Ariakit.MenuButton\n\t\t\t\t\tref={ref}\n\t\t\t\t\trender={typeof children === \"object\" && children != null ? (children as React.JSX.Element) : <button />}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<Ariakit.MenuButton ref={ref} {...props}>\n\t\t\t\t{children}\n\t\t\t</Ariakit.MenuButton>\n\t\t);\n\t},\n);\nDropdownMenuTrigger.displayName = \"DropdownMenuTrigger\";\n\nconst DropdownMenuContent = forwardRef<ElementRef<typeof Ariakit.Menu>, ComponentPropsWithoutRef<typeof Ariakit.Menu>>(\n\t({ className, gutter = 8, ...props }, ref) => (\n\t\t<Ariakit.Menu\n\t\t\tgutter={gutter}\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"z-50 min-w-[8rem] overflow-hidden rounded border border-popover bg-popover p-1.25 shadow-xl outline-none data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nDropdownMenuContent.displayName = \"DropdownMenuContent\";\n\nconst DropdownMenuItem = forwardRef<\n\tElementRef<typeof Ariakit.MenuItem>,\n\tComponentPropsWithoutRef<typeof Ariakit.MenuItem>\n>(({ className, ...props }, ref) => (\n\t<Ariakit.MenuItem\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"relative flex cursor-pointer select-none items-center rounded px-2 py-1.5 text-sm font-normal text-strong outline-none data-active-item:bg-popover-hover data-disabled:pointer-events-none data-disabled:opacity-50 data-active-item:dark:bg-popover-hover\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuItem.displayName = \"DropdownMenuItem\";\n\ntype DropdownMenuCheckboxItemProps = Omit<ComponentPropsWithoutRef<typeof Ariakit.MenuItemCheckbox>, \"render\">;\nconst DropdownMenuCheckboxItem = forwardRef<ElementRef<typeof Ariakit.MenuItemRadio>, DropdownMenuCheckboxItemProps>(\n\t({ className, children, ...props }, ref) => (\n\t\t<Ariakit.MenuItemCheckbox\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-sm font-normal text-strong outline-none data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\t\"data-active-item:bg-popover\",\n\t\t\t\t\"aria-checked:bg-filled-accent aria-checked:font-medium aria-checked:text-on-filled\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<DropdownMenuItemCheck className=\"absolute right-2 flex items-center\" />\n\t\t</Ariakit.MenuItemCheckbox>\n\t),\n);\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\";\n\ntype DropdownMenuRadioItemProps = Omit<ComponentPropsWithoutRef<typeof Ariakit.MenuItemRadio>, \"render\">;\nconst DropdownMenuRadioItem = forwardRef<ElementRef<typeof Ariakit.MenuItemRadio>, DropdownMenuRadioItemProps>(\n\t({ className, children, ...props }, ref) => (\n\t\t<Ariakit.MenuItemRadio\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-sm font-normal text-strong outline-none data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\t\"data-active-item:bg-popover-hover data-active-item:dark:bg-popover-hover\",\n\t\t\t\t\"aria-checked:!bg-filled-accent aria-checked:font-medium aria-checked:text-on-filled\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<DropdownMenuItemCheck className=\"absolute right-2 flex items-center\" />\n\t\t</Ariakit.MenuItemRadio>\n\t),\n);\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\";\n\nconst DropdownMenuItemCheck = (props: Omit<HTMLAttributes<HTMLSpanElement>, \"children\">) => (\n\t<Ariakit.MenuItemCheck {...props}>\n\t\t<Check className=\"size-5\" weight=\"bold\" />\n\t</Ariakit.MenuItemCheck>\n);\n\nconst DropdownMenuLabel = forwardRef<ElementRef<\"div\">, ComponentPropsWithoutRef<\"div\">>(\n\t({ className, ...props }, ref) => (\n\t\t<div ref={ref} className={cx(\"px-2 py-1.5 text-sm font-medium text-strong\", className)} {...props} />\n\t),\n);\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\";\n\nconst DropdownMenuSeparator = forwardRef<ElementRef<typeof Separator>, ComponentPropsWithoutRef<typeof Separator>>(\n\t({ className, ...props }, ref) => <Separator ref={ref} className={cx(\"-mx-2 my-1 w-auto\", className)} {...props} />,\n);\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\";\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n\treturn <span className={cx(\"ml-auto text-xs tracking-widest opacity-60\", className)} {...props} />;\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuTrigger,\n\tDropdownMenuContent,\n\tDropdownMenuItem,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuRadioItem,\n\tDropdownMenuLabel,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\n\t// TODO(cody): audit / add in these exports in a follow up\n\t// DropdownMenuGroup,\n\t// DropdownMenuPortal,\n\t// DropdownMenuSub,\n\t// DropdownMenuSubContent,\n\t// DropdownMenuSubTrigger,\n\t// DropdownMenuRadioGroup,\n};\n"],"mappings":"gFAAA,UAAYA,MAAa,iBACzB,OAAS,SAAAC,MAAa,8BAEtB,OAAS,cAAAC,MAAkB,QAcuE,cAAAC,EA+ChG,QAAAC,MA/CgG,oBATlG,IAAMC,EAA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C9BP,EAAS,gBAAR,CAAuB,GAAGO,EAC1B,SAAAP,EAACiB,EAAA,CAAM,UAAU,SAAS,OAAO,OAAO,EACzC,EAGKC,EAAoBd,EACzB,CAAC,CAAE,UAAAM,EAAW,GAAGH,CAAM,EAAGC,IACzBR,EAAC,OAAI,IAAKQ,EAAK,UAAWI,EAAG,8CAA+CF,CAAS,EAAI,GAAGH,EAAO,CAErG,EACAW,EAAkB,YAAc,oBAEhC,IAAMC,EAAwBf,EAC7B,CAAC,CAAE,UAAAM,EAAW,GAAGH,CAAM,EAAGC,IAAQR,EAACoB,EAAA,CAAU,IAAKZ,EAAK,UAAWI,EAAG,oBAAqBF,CAAS,EAAI,GAAGH,EAAO,CAClH,EACAY,EAAsB,YAAc,wBAEpC,IAAME,EAAuB,CAAC,CAAE,UAAAX,EAAW,GAAGH,CAAM,IAC5CP,EAAC,QAAK,UAAWY,EAAG,6CAA8CF,CAAS,EAAI,GAAGH,EAAO,EAEjGc,EAAqB,YAAc","names":["Ariakit","Check","forwardRef","jsx","jsxs","DropdownMenu","DropdownMenuTrigger","forwardRef","asChild","children","props","ref","DropdownMenuContent","className","gutter","cx","DropdownMenuItem","DropdownMenuCheckboxItem","DropdownMenuItemCheck","DropdownMenuRadioItem","Check","DropdownMenuLabel","DropdownMenuSeparator","Separator","DropdownMenuShortcut"]}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import { ClassValue } from 'clsx';
|
|
2
1
|
import { useEffect } from 'react';
|
|
3
2
|
|
|
4
|
-
/**
|
|
5
|
-
* Conditionally add Tailwind (and other) CSS classes.
|
|
6
|
-
*
|
|
7
|
-
* Allows for tailwind overrides in LTR-specificity-like order of applied classes.
|
|
8
|
-
*/
|
|
9
|
-
declare function cx(...inputs: ClassValue[]): string;
|
|
10
|
-
|
|
11
3
|
/**
|
|
12
4
|
* usePrefersReducedMotion returns true if the user has opted out of animations
|
|
13
5
|
*/
|
|
@@ -20,4 +12,4 @@ declare function useMatchesMediaQuery(query: string): boolean;
|
|
|
20
12
|
*/
|
|
21
13
|
declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
22
14
|
|
|
23
|
-
export {
|
|
15
|
+
export { useIsomorphicLayoutEffect, useMatchesMediaQuery, usePrefersReducedMotion };
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as s}from"./chunk-IGCOSMVM.js";import{useEffect as u,useState as c}from"react";var f="(prefers-reduced-motion: no-preference)";function i(){let[r,t]=c(!0);return u(()=>{let e=window.matchMedia(f);t(!e.matches);function o(n){t(!n.matches)}return e.addEventListener("change",o),()=>{e.removeEventListener("change",o)}},[]),r}import{useEffect as d,useLayoutEffect as a}from"react";var m=typeof window<"u"?a:d;export{m as useIsomorphicLayoutEffect,s as useMatchesMediaQuery,i as usePrefersReducedMotion};
|
|
2
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../packages/hooks/src/use-prefers-reduced-motion.tsx","../packages/hooks/src/use-isomorphic-layout-effect.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\n/**\n * no-preference is the default value for the prefers-reduced-motion media query.\n * Users who have never fiddled with their a11y settings will still see animations\n * (no explicit opt-in required from a user's perspective)\n */\nconst query = \"(prefers-reduced-motion: no-preference)\";\n\n/**\n * usePrefersReducedMotion returns true if the user has opted out of animations\n */\nexport function usePrefersReducedMotion() {\n\t// default to no animations, since we don't know what the user's preference is on the server\n\tconst [prefersReducedMotion, setPrefersReducedMotion] = useState(true);\n\n\tuseEffect(() => {\n\t\tconst mediaQueryList = window.matchMedia(query);\n\n\t\t// set the _real_ initial value now that we're on the client\n\t\tsetPrefersReducedMotion(!mediaQueryList.matches);\n\n\t\t// register for updates\n\t\tfunction listener(event: MediaQueryListEvent) {\n\t\t\tsetPrefersReducedMotion(!event.matches);\n\t\t}\n\n\t\tmediaQueryList.addEventListener(\"change\", listener);\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener(\"change\", listener);\n\t\t};\n\t}, []);\n\n\treturn prefersReducedMotion;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * useIsomorphicLayoutEffect is a hook that uses useLayoutEffect on the client and useEffect on the server.\n */\nexport const useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n"],"mappings":"wCAAA,OAAS,aAAAA,EAAW,YAAAC,MAAgB,QAOpC,IAAMC,EAAQ,0CAKP,SAASC,GAA0B,CAEzC,GAAM,CAACC,EAAsBC,CAAuB,EAAIJ,EAAS,EAAI,EAErE,OAAAD,EAAU,IAAM,CACf,IAAMM,EAAiB,OAAO,WAAWJ,CAAK,EAG9CG,EAAwB,CAACC,EAAe,OAAO,EAG/C,SAASC,EAASC,EAA4B,CAC7CH,EAAwB,CAACG,EAAM,OAAO,CACvC,CAEA,OAAAF,EAAe,iBAAiB,SAAUC,CAAQ,EAE3C,IAAM,CACZD,EAAe,oBAAoB,SAAUC,CAAQ,CACtD,CACD,EAAG,CAAC,CAAC,EAEEH,CACR,CCnCA,OAAS,aAAAK,EAAW,mBAAAC,MAAuB,QAKpC,IAAMC,EAA4B,OAAO,OAAW,IAAcD,EAAkBD","names":["useEffect","useState","query","usePrefersReducedMotion","prefersReducedMotion","setPrefersReducedMotion","mediaQueryList","listener","event","useEffect","useLayoutEffect","useIsomorphicLayoutEffect"]}
|
package/dist/icon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-VT3Y7SNW.js";import"./chunk-A5H52ODC.js";export{a as Icon};
|
|
2
2
|
//# sourceMappingURL=icon.js.map
|
package/dist/inline-code.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-A5H52ODC.js";import{forwardRef as d}from"react";import{jsx as m}from"react/jsx-runtime";var o=d(({className:r,...t},n)=>m("code",{ref:n,className:e("rounded-md border border-card bg-gray-500/5 px-1 py-0.5 font-mono text-[0.8em]",r),...t}));o.displayName="InlineCode";export{o as InlineCode};
|
|
2
2
|
//# sourceMappingURL=inline-code.js.map
|
package/dist/inline-code.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/inline-code/src/inline-code.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes } from \"react\";\nimport { cx } from \"../../
|
|
1
|
+
{"version":3,"sources":["../packages/inline-code/src/inline-code.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes } from \"react\";\nimport { cx } from \"../../cx\";\n\n/**\n * A component to render inline code.\n */\nconst InlineCode = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(({ className, ...props }, ref) => (\n\t<code\n\t\tref={ref}\n\t\tclassName={cx(\"rounded-md border border-card bg-gray-500/5 px-1 py-0.5 font-mono text-[0.8em]\", className)}\n\t\t{...props}\n\t/>\n));\nInlineCode.displayName = \"InlineCode\";\n\nexport { InlineCode };\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAkC,QAO1C,cAAAC,MAAA,oBADD,IAAMC,EAAaC,EAA6D,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzGL,EAAC,QACA,IAAKK,EACL,UAAWC,EAAG,iFAAkFH,CAAS,EACxG,GAAGC,EACL,CACA,EACDH,EAAW,YAAc","names":["forwardRef","jsx","InlineCode","forwardRef","className","props","ref","cx"]}
|
package/dist/input.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as I}from"./chunk-
|
|
1
|
+
import{a as I}from"./chunk-A5H52ODC.js";import{Warning as T}from"@phosphor-icons/react/Warning";import{createContext as R,forwardRef as C,useContext as M,useRef as g}from"react";import{jsx as i,jsxs as h}from"react/jsx-runtime";var m=C(({children:n,className:p,...t},r)=>{let e=!!n,o=g(null);return e?i(y,{className:p,forwardedRef:r,innerRef:o,...t,children:n}):i(y,{...t,className:p,forwardedRef:r,innerRef:o,children:i(d,{...t})})});m.displayName="Input";var d=C(({"aria-invalid":n,className:p,invalid:t=!1,...r},e)=>{let{"aria-invalid":o,invalid:a,forwardedRef:s,innerRef:f,...u}=M(w),P=o??a??n??t,v={...u,...r,type:r.type??u.type??"text"};return i("input",{"aria-invalid":P,className:I("min-w-0 flex-1 bg-form placeholder:text-placeholder focus:outline-none",p),ref:l=>{typeof e=="function"?e(l):e&&(e.current=l),typeof s=="function"?s(l):s&&(s.current=l),f.current=l},...v})});d.displayName="InputCapture";var w=R({invalid:!1,innerRef:{current:null}}),y=({"aria-invalid":n,children:p,className:t,forwardedRef:r,innerRef:e,invalid:o,style:a,type:s,...f})=>{let u=n??o;return i(w.Provider,{value:{"aria-invalid":n,invalid:o,type:s,...f,forwardedRef:r,innerRef:e},children:h("div",{"aria-invalid":u,className:I("flex h-11 w-full items-center gap-1.5 rounded-md border bg-form px-3 py-2 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-within:outline-none focus-within:ring-4 focus-visible:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 sm:h-9 sm:text-sm","has-[input:not(:first-child)]:ps-2.5 has-[input:not(:last-child)]:pe-2.5 [&>:not(input)]:shrink-0 [&_svg]:size-6 sm:[&_svg]:size-5","border-form text-strong focus-within:border-accent-600 focus-within:ring-focus-accent",u&&"border-danger-600 pe-2.5 focus-within:border-danger-600 focus-within:ring-focus-danger",t),onClick:()=>{e?.current?.focus()},style:a,children:[p,o&&h("div",{className:"pointer-events-none order-last select-none text-danger-600",children:[i("span",{className:"sr-only",children:["The value entered for the",f.name,"input has failed validation."].filter(Boolean).join(" ")}),i(T,{"aria-hidden":!0,weight:"fill"})]})]})})};import{Eye as E}from"@phosphor-icons/react/Eye";import{EyeClosed as H}from"@phosphor-icons/react/EyeClosed";import{forwardRef as L,useState as W}from"react";import{jsx as b,jsxs as c}from"react/jsx-runtime";var x=L((n,p)=>{let[t,r]=W(!1);return c(m,{type:t?"text":"password",ref:p,...n,children:[b(d,{}),c("button",{type:"button",tabIndex:-1,className:"ml-1 cursor-pointer bg-inherit p-0 text-body hover:text-strong",onClick:()=>{r(a=>!a)},children:[c("span",{className:"sr-only",children:["Turn password visibility ",t?"off":"on"]}),b(t?E:H,{"aria-hidden":!0})]})]})});x.displayName="PasswordInput";export{m as Input,d as InputCapture,x as PasswordInput};
|
|
2
2
|
//# sourceMappingURL=input.js.map
|
package/dist/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/input/src/input.tsx","../packages/input/src/password-input.tsx"],"sourcesContent":["import { Warning } from \"@phosphor-icons/react/Warning\";\nimport type { ForwardedRef, InputHTMLAttributes, MutableRefObject, PropsWithChildren } from \"react\";\nimport { createContext, ElementRef, forwardRef, useContext, useRef } from \"react\";\nimport { cx } from \"../../core\";\nimport type { WithAutoComplete, WithInputType, WithInvalid } from \"./types\";\n\ntype BaseProps = WithAutoComplete & WithInputType & WithInvalid;\n\n/**\n * The props for the `Input` component.\n */\ntype InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> & BaseProps & PropsWithChildren;\n\n/**\n * Used to create interactive controls for web-based forms in order to accept data from the user\n */\nconst Input = forwardRef<HTMLInputElement, InputProps>(({ children, className, ...props }, forwardedRef) => {\n\tconst hasChildren = Boolean(children);\n\tconst innerRef = useRef<ElementRef<\"input\">>(null);\n\n\tif (hasChildren) {\n\t\treturn (\n\t\t\t<InputContainer className={className} forwardedRef={forwardedRef} innerRef={innerRef} {...props}>\n\t\t\t\t{children}\n\t\t\t</InputContainer>\n\t\t);\n\t}\n\n\treturn (\n\t\t<InputContainer {...props} className={className} forwardedRef={forwardedRef} innerRef={innerRef}>\n\t\t\t<InputCapture {...props} />\n\t\t</InputContainer>\n\t);\n});\nInput.displayName = \"Input\";\n\ntype InputCaptureProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> & BaseProps;\n\n/**\n * The actual <input /> element that captures user input.\n */\nconst InputCapture = forwardRef<HTMLInputElement, InputCaptureProps>(\n\t({ \"aria-invalid\": _ariaInvalid, className, invalid = false, ...restProps }, ref) => {\n\t\tconst {\n\t\t\t\"aria-invalid\": ctxAriaInvalid,\n\t\t\tinvalid: ctxInvalid,\n\t\t\tforwardedRef: ctxForwardedRef,\n\t\t\tinnerRef: ctxInnerRef,\n\t\t\t...ctx\n\t\t} = useContext(InputContext);\n\t\tconst ariaInvalid = ctxAriaInvalid ?? ctxInvalid ?? _ariaInvalid ?? invalid;\n\t\tconst props = { ...ctx, ...restProps, type: restProps.type ?? ctx.type ?? \"text\" };\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cx(\"min-w-0 flex-1 bg-form placeholder:text-placeholder focus:outline-none\", className)}\n\t\t\t\tref={(node) => {\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof ctxForwardedRef === \"function\") {\n\t\t\t\t\t\tctxForwardedRef(node);\n\t\t\t\t\t} else if (ctxForwardedRef) {\n\t\t\t\t\t\tctxForwardedRef.current = node;\n\t\t\t\t\t}\n\t\t\t\t\tctxInnerRef.current = node;\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nInputCapture.displayName = \"InputCapture\";\n\ntype InputContextType = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> &\n\tBaseProps & {\n\t\t/**\n\t\t * inner ref for the input element, controlled by `Input`\n\t\t */\n\t\tinnerRef: MutableRefObject<HTMLInputElement | null>;\n\t\t/**\n\t\t * forwarded ref to the input element, forwarded from `Input` to `InputCapture`\n\t\t */\n\t\tforwardedRef?: ForwardedRef<HTMLInputElement>;\n\t};\n\nconst InputContext = createContext<InputContextType>({ invalid: false, innerRef: { current: null } });\n\ntype InputContainerProps = InputHTMLAttributes<HTMLInputElement> &\n\tBaseProps & {\n\t\t/**\n\t\t * @private inner ref for the input element, controlled by `Input`\n\t\t */\n\t\tinnerRef: MutableRefObject<HTMLInputElement | null>;\n\t\t/**\n\t\t * @private ref to the input element, forwarded from `Input` to `InputCapture`\n\t\t */\n\t\tforwardedRef: ForwardedRef<HTMLInputElement>;\n\t};\n\n/**\n * The container for the input element.\n */\nconst InputContainer = ({\n\t\"aria-invalid\": _ariaInvalid,\n\tchildren,\n\tclassName,\n\tforwardedRef,\n\tinnerRef,\n\tinvalid,\n\tstyle,\n\ttype,\n\t...props\n}: InputContainerProps) => {\n\tconst ariaInvalid = _ariaInvalid ?? invalid;\n\n\treturn (\n\t\t<InputContext.Provider\n\t\t\tvalue={{\n\t\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\t\tinvalid,\n\t\t\t\ttype,\n\t\t\t\t...props,\n\t\t\t\tforwardedRef,\n\t\t\t\tinnerRef,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex h-11 w-full items-center gap-1.5 rounded-md border bg-form px-3 py-2 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-within:outline-none focus-within:ring-4 focus-visible:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 sm:h-9 sm:text-sm\",\n\t\t\t\t\t\"has-[input:not(:first-child)]:ps-2.5 has-[input:not(:last-child)]:pe-2.5 [&>:not(input)]:shrink-0 [&_svg]:size-6 sm:[&_svg]:size-5\",\n\t\t\t\t\t\"border-form text-strong focus-within:border-accent-600 focus-within:ring-focus-accent\",\n\t\t\t\t\tariaInvalid && \"border-danger-600 pe-2.5 focus-within:border-danger-600 focus-within:ring-focus-danger\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonClick={() => {\n\t\t\t\t\tinnerRef?.current?.focus();\n\t\t\t\t}}\n\t\t\t\tstyle={style}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{invalid && (\n\t\t\t\t\t<div className=\"pointer-events-none order-last select-none text-danger-600\">\n\t\t\t\t\t\t<span className=\"sr-only\">\n\t\t\t\t\t\t\t{[\"The value entered for the\", props.name, \"input has failed validation.\"].filter(Boolean).join(\" \")}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<Warning aria-hidden weight=\"fill\" />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</InputContext.Provider>\n\t);\n};\n\nexport { Input, InputCapture };\nexport type { InputProps, InputCaptureProps };\n","import { Eye } from \"@phosphor-icons/react/Eye\";\nimport { EyeClosed } from \"@phosphor-icons/react/EyeClosed\";\nimport { forwardRef, useState } from \"react\";\nimport type { InputHTMLAttributes } from \"react\";\nimport { Input, InputCapture } from \"./input\";\nimport type { InputType, WithAutoComplete, WithInvalid } from \"./types\";\n\ntype PasswordInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> &\n\tWithInvalid &\n\tWithAutoComplete;\n\ntype PasswordInputType = Extract<InputType, \"text\" | \"password\">;\n\nconst PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>((props, ref) => {\n\tconst [showPassword, setShowPassword] = useState<boolean>(false);\n\tconst type: PasswordInputType = showPassword ? \"text\" : \"password\";\n\tconst EyeCon = showPassword ? Eye : EyeClosed;\n\n\treturn (\n\t\t<Input type={type} ref={ref} {...props}>\n\t\t\t<InputCapture />\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\tclassName=\"ml-1 cursor-pointer bg-inherit p-0 text-body hover:text-strong\"\n\t\t\t\tonClick={() => {\n\t\t\t\t\tsetShowPassword((s) => !s);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span className=\"sr-only\">Turn password visibility {showPassword ? \"off\" : \"on\"}</span>\n\t\t\t\t<EyeCon aria-hidden />\n\t\t\t</button>\n\t\t</Input>\n\t);\n});\nPasswordInput.displayName = \"PasswordInput\";\n\nexport { PasswordInput };\nexport type { PasswordInputProps };\n"],"mappings":"oEAAA,OAAS,WAAAA,MAAe,gCAExB,OAAS,iBAAAC,EAA2B,cAAAC,EAAY,cAAAC,EAAY,UAAAC,MAAc,QAoBvE,cAAAC,EA4HE,QAAAC,MA5HF,oBANH,IAAMC,EAAQC,EAAyC,CAAC,CAAE,SAAAC,EAAU,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAAiB,CAC3G,IAAMC,EAAc,EAAQJ,EACtBK,EAAWC,EAA4B,IAAI,EAEjD,OAAIF,EAEFR,EAACW,EAAA,CAAe,UAAWN,EAAW,aAAcE,EAAc,SAAUE,EAAW,GAAGH,EACxF,SAAAF,EACF,EAKDJ,EAACW,EAAA,CAAgB,GAAGL,EAAO,UAAWD,EAAW,aAAcE,EAAc,SAAUE,EACtF,SAAAT,EAACY,EAAA,CAAc,GAAGN,EAAO,EAC1B,CAEF,CAAC,EACDJ,EAAM,YAAc,QAOpB,IAAMU,EAAeT,EACpB,CAAC,CAAE,eAAgBU,EAAc,UAAAR,EAAW,QAAAS,EAAU,GAAO,GAAGC,CAAU,EAAGC,IAAQ,CACpF,GAAM,CACL,eAAgBC,EAChB,QAASC,EACT,aAAcC,EACd,SAAUC,EACV,GAAGC,CACJ,EAAIC,EAAWC,CAAY,EACrBC,EAAcP,GAAkBC,GAAcL,GAAgBC,EAC9DR,EAAQ,CAAE,GAAGe,EAAK,GAAGN,EAAW,KAAMA,EAAU,MAAQM,EAAI,MAAQ,MAAO,EAEjF,OACCrB,EAAC,SACA,eAAcwB,EACd,UAAWC,EAAG,yEAA0EpB,CAAS,EACjG,IAAMqB,GAAS,CACV,OAAOV,GAAQ,WAClBA,EAAIU,CAAI,EACEV,IACVA,EAAI,QAAUU,GAEX,OAAOP,GAAoB,WAC9BA,EAAgBO,CAAI,EACVP,IACVA,EAAgB,QAAUO,GAE3BN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,QAAS,IAAM,CACdM,EAAiBI,GAAM,CAACA,CAAC,CAC1B,EAEA,UAAAV,EAAC,QAAK,UAAU,UAAU,sCAA0BK,EAAe,MAAQ,MAAK,EAChFN,EAdYM,EAAeM,EAAMC,EAchC,CAAO,cAAW,GAAC,GACrB,GACD,CAEF,CAAC,EACDX,EAAc,YAAc","names":["Warning","createContext","forwardRef","useContext","useRef","jsx","jsxs","Input","forwardRef","children","className","props","forwardedRef","hasChildren","innerRef","useRef","InputContainer","InputCapture","_ariaInvalid","invalid","restProps","ref","ctxAriaInvalid","ctxInvalid","ctxForwardedRef","ctxInnerRef","ctx","useContext","InputContext","ariaInvalid","cx","node","createContext","style","type","Warning","Eye","EyeClosed","forwardRef","useState","jsx","jsxs","PasswordInput","forwardRef","props","ref","showPassword","setShowPassword","useState","Input","InputCapture","s","Eye","EyeClosed"]}
|
|
1
|
+
{"version":3,"sources":["../packages/input/src/input.tsx","../packages/input/src/password-input.tsx"],"sourcesContent":["import { Warning } from \"@phosphor-icons/react/Warning\";\nimport type { ForwardedRef, InputHTMLAttributes, MutableRefObject, PropsWithChildren } from \"react\";\nimport { createContext, ElementRef, forwardRef, useContext, useRef } from \"react\";\nimport { cx } from \"../../cx\";\nimport type { WithAutoComplete, WithInputType, WithInvalid } from \"./types\";\n\ntype BaseProps = WithAutoComplete & WithInputType & WithInvalid;\n\n/**\n * The props for the `Input` component.\n */\ntype InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> & BaseProps & PropsWithChildren;\n\n/**\n * Used to create interactive controls for web-based forms in order to accept data from the user\n */\nconst Input = forwardRef<HTMLInputElement, InputProps>(({ children, className, ...props }, forwardedRef) => {\n\tconst hasChildren = Boolean(children);\n\tconst innerRef = useRef<ElementRef<\"input\">>(null);\n\n\tif (hasChildren) {\n\t\treturn (\n\t\t\t<InputContainer className={className} forwardedRef={forwardedRef} innerRef={innerRef} {...props}>\n\t\t\t\t{children}\n\t\t\t</InputContainer>\n\t\t);\n\t}\n\n\treturn (\n\t\t<InputContainer {...props} className={className} forwardedRef={forwardedRef} innerRef={innerRef}>\n\t\t\t<InputCapture {...props} />\n\t\t</InputContainer>\n\t);\n});\nInput.displayName = \"Input\";\n\ntype InputCaptureProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> & BaseProps;\n\n/**\n * The actual <input /> element that captures user input.\n */\nconst InputCapture = forwardRef<HTMLInputElement, InputCaptureProps>(\n\t({ \"aria-invalid\": _ariaInvalid, className, invalid = false, ...restProps }, ref) => {\n\t\tconst {\n\t\t\t\"aria-invalid\": ctxAriaInvalid,\n\t\t\tinvalid: ctxInvalid,\n\t\t\tforwardedRef: ctxForwardedRef,\n\t\t\tinnerRef: ctxInnerRef,\n\t\t\t...ctx\n\t\t} = useContext(InputContext);\n\t\tconst ariaInvalid = ctxAriaInvalid ?? ctxInvalid ?? _ariaInvalid ?? invalid;\n\t\tconst props = { ...ctx, ...restProps, type: restProps.type ?? ctx.type ?? \"text\" };\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cx(\"min-w-0 flex-1 bg-form placeholder:text-placeholder focus:outline-none\", className)}\n\t\t\t\tref={(node) => {\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof ctxForwardedRef === \"function\") {\n\t\t\t\t\t\tctxForwardedRef(node);\n\t\t\t\t\t} else if (ctxForwardedRef) {\n\t\t\t\t\t\tctxForwardedRef.current = node;\n\t\t\t\t\t}\n\t\t\t\t\tctxInnerRef.current = node;\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nInputCapture.displayName = \"InputCapture\";\n\ntype InputContextType = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> &\n\tBaseProps & {\n\t\t/**\n\t\t * inner ref for the input element, controlled by `Input`\n\t\t */\n\t\tinnerRef: MutableRefObject<HTMLInputElement | null>;\n\t\t/**\n\t\t * forwarded ref to the input element, forwarded from `Input` to `InputCapture`\n\t\t */\n\t\tforwardedRef?: ForwardedRef<HTMLInputElement>;\n\t};\n\nconst InputContext = createContext<InputContextType>({ invalid: false, innerRef: { current: null } });\n\ntype InputContainerProps = InputHTMLAttributes<HTMLInputElement> &\n\tBaseProps & {\n\t\t/**\n\t\t * @private inner ref for the input element, controlled by `Input`\n\t\t */\n\t\tinnerRef: MutableRefObject<HTMLInputElement | null>;\n\t\t/**\n\t\t * @private ref to the input element, forwarded from `Input` to `InputCapture`\n\t\t */\n\t\tforwardedRef: ForwardedRef<HTMLInputElement>;\n\t};\n\n/**\n * The container for the input element.\n */\nconst InputContainer = ({\n\t\"aria-invalid\": _ariaInvalid,\n\tchildren,\n\tclassName,\n\tforwardedRef,\n\tinnerRef,\n\tinvalid,\n\tstyle,\n\ttype,\n\t...props\n}: InputContainerProps) => {\n\tconst ariaInvalid = _ariaInvalid ?? invalid;\n\n\treturn (\n\t\t<InputContext.Provider\n\t\t\tvalue={{\n\t\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\t\tinvalid,\n\t\t\t\ttype,\n\t\t\t\t...props,\n\t\t\t\tforwardedRef,\n\t\t\t\tinnerRef,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex h-11 w-full items-center gap-1.5 rounded-md border bg-form px-3 py-2 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-within:outline-none focus-within:ring-4 focus-visible:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 sm:h-9 sm:text-sm\",\n\t\t\t\t\t\"has-[input:not(:first-child)]:ps-2.5 has-[input:not(:last-child)]:pe-2.5 [&>:not(input)]:shrink-0 [&_svg]:size-6 sm:[&_svg]:size-5\",\n\t\t\t\t\t\"border-form text-strong focus-within:border-accent-600 focus-within:ring-focus-accent\",\n\t\t\t\t\tariaInvalid && \"border-danger-600 pe-2.5 focus-within:border-danger-600 focus-within:ring-focus-danger\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonClick={() => {\n\t\t\t\t\tinnerRef?.current?.focus();\n\t\t\t\t}}\n\t\t\t\tstyle={style}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{invalid && (\n\t\t\t\t\t<div className=\"pointer-events-none order-last select-none text-danger-600\">\n\t\t\t\t\t\t<span className=\"sr-only\">\n\t\t\t\t\t\t\t{[\"The value entered for the\", props.name, \"input has failed validation.\"].filter(Boolean).join(\" \")}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<Warning aria-hidden weight=\"fill\" />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</InputContext.Provider>\n\t);\n};\n\nexport { Input, InputCapture };\nexport type { InputProps, InputCaptureProps };\n","import { Eye } from \"@phosphor-icons/react/Eye\";\nimport { EyeClosed } from \"@phosphor-icons/react/EyeClosed\";\nimport { forwardRef, useState } from \"react\";\nimport type { InputHTMLAttributes } from \"react\";\nimport { Input, InputCapture } from \"./input\";\nimport type { InputType, WithAutoComplete, WithInvalid } from \"./types\";\n\ntype PasswordInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> &\n\tWithInvalid &\n\tWithAutoComplete;\n\ntype PasswordInputType = Extract<InputType, \"text\" | \"password\">;\n\nconst PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>((props, ref) => {\n\tconst [showPassword, setShowPassword] = useState<boolean>(false);\n\tconst type: PasswordInputType = showPassword ? \"text\" : \"password\";\n\tconst EyeCon = showPassword ? Eye : EyeClosed;\n\n\treturn (\n\t\t<Input type={type} ref={ref} {...props}>\n\t\t\t<InputCapture />\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\tclassName=\"ml-1 cursor-pointer bg-inherit p-0 text-body hover:text-strong\"\n\t\t\t\tonClick={() => {\n\t\t\t\t\tsetShowPassword((s) => !s);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span className=\"sr-only\">Turn password visibility {showPassword ? \"off\" : \"on\"}</span>\n\t\t\t\t<EyeCon aria-hidden />\n\t\t\t</button>\n\t\t</Input>\n\t);\n});\nPasswordInput.displayName = \"PasswordInput\";\n\nexport { PasswordInput };\nexport type { PasswordInputProps };\n"],"mappings":"wCAAA,OAAS,WAAAA,MAAe,gCAExB,OAAS,iBAAAC,EAA2B,cAAAC,EAAY,cAAAC,EAAY,UAAAC,MAAc,QAoBvE,cAAAC,EA4HE,QAAAC,MA5HF,oBANH,IAAMC,EAAQC,EAAyC,CAAC,CAAE,SAAAC,EAAU,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAAiB,CAC3G,IAAMC,EAAc,EAAQJ,EACtBK,EAAWC,EAA4B,IAAI,EAEjD,OAAIF,EAEFR,EAACW,EAAA,CAAe,UAAWN,EAAW,aAAcE,EAAc,SAAUE,EAAW,GAAGH,EACxF,SAAAF,EACF,EAKDJ,EAACW,EAAA,CAAgB,GAAGL,EAAO,UAAWD,EAAW,aAAcE,EAAc,SAAUE,EACtF,SAAAT,EAACY,EAAA,CAAc,GAAGN,EAAO,EAC1B,CAEF,CAAC,EACDJ,EAAM,YAAc,QAOpB,IAAMU,EAAeT,EACpB,CAAC,CAAE,eAAgBU,EAAc,UAAAR,EAAW,QAAAS,EAAU,GAAO,GAAGC,CAAU,EAAGC,IAAQ,CACpF,GAAM,CACL,eAAgBC,EAChB,QAASC,EACT,aAAcC,EACd,SAAUC,EACV,GAAGC,CACJ,EAAIC,EAAWC,CAAY,EACrBC,EAAcP,GAAkBC,GAAcL,GAAgBC,EAC9DR,EAAQ,CAAE,GAAGe,EAAK,GAAGN,EAAW,KAAMA,EAAU,MAAQM,EAAI,MAAQ,MAAO,EAEjF,OAC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IAAQ,CACtF,GAAM,CAACC,EAAcC,CAAe,EAAIC,EAAkB,EAAK,EAI/D,OACCP,EAACQ,EAAA,CAAM,KAJwBH,EAAe,OAAS,WAIpC,IAAKD,EAAM,GAAGD,EAChC,UAAAJ,EAACU,EAAA,EAAa,EACdT,EAAC,UACA,KAAK,SACL,SAAU,GACV,UAAU,iEACV,QAAS,IAAM,CACdM,EAAiBI,GAAM,CAACA,CAAC,CAC1B,EAEA,UAAAV,EAAC,QAAK,UAAU,UAAU,sCAA0BK,EAAe,MAAQ,MAAK,EAChFN,EAdYM,EAAeM,EAAMC,EAchC,CAAO,cAAW,GAAC,GACrB,GACD,CAEF,CAAC,EACDX,EAAc,YAAc","names":["Warning","createContext","forwardRef","useContext","useRef","jsx","jsxs","Input","forwardRef","children","className","props","forwardedRef","hasChildren","innerRef","useRef","InputContainer","InputCapture","_ariaInvalid","invalid","restProps","ref","ctxAriaInvalid","ctxInvalid","ctxForwardedRef","ctxInnerRef","ctx","useContext","InputContext","ariaInvalid","cx","node","createContext","style","type","Warning","Eye","EyeClosed","forwardRef","useState","jsx","jsxs","PasswordInput","forwardRef","props","ref","showPassword","setShowPassword","useState","Input","InputCapture","s","Eye","EyeClosed"]}
|
package/dist/media-object.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-A5H52ODC.js";import{forwardRef as M}from"react";import{jsx as m}from"react/jsx-runtime";var n=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("flex gap-4",e),style:i,children:t}));n.displayName="MediaObject";var s=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("shrink-0 leading-none",e),style:i,children:t}));s.displayName="MediaObjectMedia";var l=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("min-w-0 flex-1",e),style:i,children:t}));l.displayName="MediaObjectContent";export{n as MediaObject,l as MediaObjectContent,s as MediaObjectMedia};
|
|
2
2
|
//# sourceMappingURL=media-object.js.map
|
package/dist/media-object.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/media-object/src/media-object.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../
|
|
1
|
+
{"version":3,"sources":["../packages/media-object/src/media-object.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../cx\";\n\n/**\n * The media object is an image/icon (media) to the left, with descriptive\n * content (title and subtitle/description) to the right.\n *\n * Change the spacing between the media and content by passing a `gap-*` class.\n * The default gap is `gap-4`.\n *\n * Use flexbox utilities to change the alignment of the media and content.\n *\n * Compose the media object with the `MediaObjectMedia` and `MediaObjectContent`\n * components as direct children.\n */\nconst MediaObject = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"flex gap-4\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObject.displayName = \"MediaObject\";\n\n/**\n * The container for an image or icon to display in the media slot of the media object.\n */\nconst MediaObjectMedia = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"shrink-0 leading-none\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObjectMedia.displayName = \"MediaObjectMedia\";\n\n/**\n * The container for the content slot of a media object.\n */\nconst MediaObjectContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"min-w-0 flex-1\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObjectContent.displayName = \"MediaObjectContent\";\n\nexport { MediaObject, MediaObjectMedia, MediaObjectContent };\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAkB,QAkBzB,cAAAC,MAAA,oBAFF,IAAMC,EAAcC,EACnB,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,aAAcJ,CAAS,EAAG,MAAOE,EAC5D,SAAAD,EACF,CAEF,EACAH,EAAY,YAAc,cAK1B,IAAMO,EAAmBN,EACxB,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,wBAAyBJ,CAAS,EAAG,MAAOE,EACvE,SAAAD,EACF,CAEF,EACAI,EAAiB,YAAc,mBAK/B,IAAMC,EAAqBP,EAC1B,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,iBAAkBJ,CAAS,EAAG,MAAOE,EAChE,SAAAD,EACF,CAEF,EACAK,EAAmB,YAAc","names":["forwardRef","jsx","MediaObject","forwardRef","className","children","style","ref","cx","MediaObjectMedia","MediaObjectContent"]}
|
package/dist/popover.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-A5H52ODC.js";import*as o from"@radix-ui/react-popover";import{forwardRef as m}from"react";import{jsx as t}from"react/jsx-runtime";var s=o.Root,P=o.Trigger,r=m(({className:i,align:a="center",sideOffset:p=4,...n},d)=>t(o.Portal,{children:t(o.Content,{ref:d,align:a,sideOffset:p,className:e("text-popover-foreground z-50 w-72 rounded-md border border-popover bg-popover p-4 shadow-md outline-none data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95",i),...n})}));r.displayName=o.Content.displayName;export{s as Popover,r as PopoverContent,P as PopoverTrigger};
|
|
2
2
|
//# sourceMappingURL=popover.js.map
|
package/dist/popover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/popover/src/popover.tsx"],"sourcesContent":["import * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { ComponentPropsWithoutRef, ElementRef, forwardRef } from \"react\";\nimport { cx } from \"../../
|
|
1
|
+
{"version":3,"sources":["../packages/popover/src/popover.tsx"],"sourcesContent":["import * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { ComponentPropsWithoutRef, ElementRef, forwardRef } from \"react\";\nimport { cx } from \"../../cx\";\n\nconst Popover = PopoverPrimitive.Root;\n\nconst PopoverTrigger = PopoverPrimitive.Trigger;\n\nconst PopoverContent = forwardRef<\n\tElementRef<typeof PopoverPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n\t<PopoverPrimitive.Portal>\n\t\t<PopoverPrimitive.Content\n\t\t\tref={ref}\n\t\t\talign={align}\n\t\t\tsideOffset={sideOffset}\n\t\t\tclassName={cx(\n\t\t\t\t\"text-popover-foreground z-50 w-72 rounded-md border border-popover bg-popover p-4 shadow-md outline-none data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t</PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nexport { Popover, PopoverTrigger, PopoverContent };\n"],"mappings":"wCAAA,UAAYA,MAAsB,0BAClC,OAA+C,cAAAC,MAAkB,QAY/D,cAAAC,MAAA,oBATF,IAAMC,EAA2B,OAE3BC,EAAkC,UAElCC,EAAiBC,EAGrB,CAAC,CAAE,UAAAC,EAAW,MAAAC,EAAQ,SAAU,WAAAC,EAAa,EAAG,GAAGC,CAAM,EAAGC,IAC7DT,EAAkB,SAAjB,CACA,SAAAA,EAAkB,UAAjB,CACA,IAAKS,EACL,MAAOH,EACP,WAAYC,EACZ,UAAWG,EACV,waACAL,CACD,EACC,GAAGG,EACL,EACD,CACA,EACDL,EAAe,YAA+B,UAAQ","names":["PopoverPrimitive","forwardRef","jsx","Popover","PopoverTrigger","PopoverContent","forwardRef","className","align","sideOffset","props","ref","cx"]}
|
package/dist/select.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-C2ECUIPG.js";import{a}from"./chunk-A5H52ODC.js";import{CaretDown as p}from"@phosphor-icons/react/CaretDown";import{CaretUp as b}from"@phosphor-icons/react/CaretUp";import{Check as x}from"@phosphor-icons/react/Check";import*as e from"@radix-ui/react-select";import{cva as C}from"class-variance-authority";import{createContext as w,forwardRef as l,useContext as R}from"react";import{jsx as t,jsxs as m}from"react/jsx-runtime";var f=w(void 0),N=({children:o,...i})=>t(e.Root,{...i,children:t(f.Provider,{value:i["aria-invalid"],children:o})}),I=e.Group,T=e.Value,B=C("flex h-11 w-full items-center justify-between rounded-md border border-form bg-form px-3 py-2 placeholder:text-placeholder hover:bg-form-hover focus:outline-none focus:ring-4 disabled:pointer-events-none disabled:opacity-50 aria-expanded:ring-4 sm:h-9 sm:text-sm [&>span]:line-clamp-1 [&>span]:text-left",{variants:{state:{danger:"border-danger-600 focus:border-danger-600 focus:ring-focus-danger aria-expanded:border-danger-600 aria-expanded:ring-focus-danger",default:"borderpform text-strong placeholder:text-placeholder focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent"}},defaultVariants:{state:"default"}}),S=l(({className:o,children:i,...r},n)=>{let s=R(f),c=r["aria-invalid"]??s;return m(e.Trigger,{ref:n,className:a(B({state:c?"danger":"default"}),o),...r,"aria-invalid":c,children:[i,t(e.Icon,{asChild:!0,children:t(p,{className:"size-4 shrink-0",weight:"bold"})})]})});S.displayName="SelectTrigger";var u=l(({className:o,...i},r)=>t(e.ScrollUpButton,{ref:r,className:a("flex cursor-default items-center justify-center py-1",o),...i,children:t(b,{className:"size-4",weight:"bold"})}));u.displayName="SelectScrollUpButton";var v=l(({className:o,...i},r)=>t(e.ScrollDownButton,{ref:r,className:a("flex cursor-default items-center justify-center py-1",o),...i,children:t(p,{className:"size-4",weight:"bold"})}));v.displayName="SelectScrollDownButton";var g=l(({className:o,children:i,position:r="popper",width:n,...s},c)=>t(e.Portal,{children:m(e.Content,{ref:c,className:a("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-popover shadow-md data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95","bg-popover",r==="popper"&&"max-h-[var(--radix-select-content-available-height)] data-side-bottom:translate-y-2 data-side-left:-translate-x-2 data-side-right:translate-x-2 data-side-top:-translate-y-2",n==="trigger"&&"w-[var(--radix-select-trigger-width)]",o),position:r,...s,children:[t(u,{}),t(e.Viewport,{className:a("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full"),children:i}),t(v,{})]})}));g.displayName="SelectContent";var P=l(({className:o,...i},r)=>t(e.Label,{ref:r,className:a("px-2 py-1.5 text-sm font-semibold",o),...i}));P.displayName="SelectLabel";var h=l(({className:o,children:i,...r},n)=>m(e.Item,{ref:n,className:a("relative flex w-full cursor-pointer select-none items-center rounded py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-popover-hover data-state-checked:bg-filled-accent data-state-checked:text-on-filled data-disabled:pointer-events-none data-disabled:opacity-50",o),...r,children:[t(e.ItemText,{children:i}),t(e.ItemIndicator,{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t(x,{className:"size-4",weight:"bold"})})]}));h.displayName="SelectItem";var y=l(({className:o,...i},r)=>t(d,{ref:r,className:a("-mx-1 my-1 h-px w-auto",o),...i}));y.displayName="SelectSeparator";export{N as Select,g as SelectContent,I as SelectGroup,h as SelectItem,P as SelectLabel,y as SelectSeparator,S as SelectTrigger,T as SelectValue};
|
|
2
2
|
//# sourceMappingURL=select.js.map
|
package/dist/select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/select/src/select.tsx"],"sourcesContent":["import { CaretDown } from \"@phosphor-icons/react/CaretDown\";\nimport { CaretUp } from \"@phosphor-icons/react/CaretUp\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { cva } from \"class-variance-authority\";\nimport type { ComponentPropsWithoutRef, ElementRef, SelectHTMLAttributes } from \"react\";\nimport { createContext, forwardRef, useContext } from \"react\";\nimport { cx } from \"../../core\";\nimport { Separator } from \"../../separator\";\nimport type { VariantProps } from \"../../types/src/variant-props\";\n\nconst SelectAriaInvalidContext = createContext<SelectHTMLAttributes<HTMLSelectElement>[\"aria-invalid\"]>(undefined);\n\ntype SelectProps = ComponentPropsWithoutRef<typeof SelectPrimitive.Root> &\n\tPick<SelectHTMLAttributes<HTMLSelectElement>, \"aria-invalid\">;\n\nconst Select = ({ children, ...props }: SelectProps) => {\n\treturn (\n\t\t<SelectPrimitive.Root {...props}>\n\t\t\t<SelectAriaInvalidContext.Provider value={props[\"aria-invalid\"]}>{children}</SelectAriaInvalidContext.Provider>\n\t\t</SelectPrimitive.Root>\n\t);\n};\n\nconst SelectGroup = SelectPrimitive.Group;\n\nconst SelectValue = SelectPrimitive.Value;\n\nconst selectTriggerVariants = cva(\n\t\"flex h-11 w-full items-center justify-between rounded-md border border-form bg-form px-3 py-2 placeholder:text-placeholder hover:bg-form-hover focus:outline-none focus:ring-4 disabled:pointer-events-none disabled:opacity-50 aria-expanded:ring-4 sm:h-9 sm:text-sm [&>span]:line-clamp-1 [&>span]:text-left\",\n\t{\n\t\tvariants: {\n\t\t\tstate: {\n\t\t\t\tdanger:\n\t\t\t\t\t\"border-danger-600 focus:border-danger-600 focus:ring-focus-danger aria-expanded:border-danger-600 aria-expanded:ring-focus-danger\",\n\t\t\t\tdefault:\n\t\t\t\t\t\"borderpform text-strong placeholder:text-placeholder focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tstate: \"default\",\n\t\t},\n\t},\n);\n\ntype SelectTriggerVariants = VariantProps<typeof selectTriggerVariants>;\n\nconst SelectTrigger = forwardRef<\n\tElementRef<typeof SelectPrimitive.Trigger>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => {\n\tconst ariaInvalidContext = useContext(SelectAriaInvalidContext);\n\tconst ariaInvalid = props[\"aria-invalid\"] ?? ariaInvalidContext;\n\tconst state = ariaInvalid ? \"danger\" : (\"default\" satisfies SelectTriggerVariants[\"state\"]);\n\n\treturn (\n\t\t<SelectPrimitive.Trigger\n\t\t\tref={ref}\n\t\t\tclassName={cx(selectTriggerVariants({ state }), className)}\n\t\t\t{...props}\n\t\t\taria-invalid={ariaInvalid}\n\t\t>\n\t\t\t{children}\n\t\t\t<SelectPrimitive.Icon asChild>\n\t\t\t\t<CaretDown className=\"size-4 shrink-0\" weight=\"bold\" />\n\t\t\t</SelectPrimitive.Icon>\n\t\t</SelectPrimitive.Trigger>\n\t);\n});\nSelectTrigger.displayName = \"SelectTrigger\";\n\nconst SelectScrollUpButton = forwardRef<\n\tElementRef<typeof SelectPrimitive.ScrollUpButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollUpButton\n\t\tref={ref}\n\t\tclassName={cx(\"flex cursor-default items-center justify-center py-1\", className)}\n\t\t{...props}\n\t>\n\t\t<CaretUp className=\"size-4\" weight=\"bold\" />\n\t</SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = \"SelectScrollUpButton\";\n\nconst SelectScrollDownButton = forwardRef<\n\tElementRef<typeof SelectPrimitive.ScrollDownButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollDownButton\n\t\tref={ref}\n\t\tclassName={cx(\"flex cursor-default items-center justify-center py-1\", className)}\n\t\t{...props}\n\t>\n\t\t<CaretDown className=\"size-4\" weight=\"bold\" />\n\t</SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = \"SelectScrollDownButton\";\n\ntype SelectContentProps = ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n\twidth?: \"trigger\" | \"content\";\n};\n\nconst SelectContent = forwardRef<ElementRef<typeof SelectPrimitive.Content>, SelectContentProps>(\n\t({ className, children, position = \"popper\", width, ...props }, ref) => (\n\t\t<SelectPrimitive.Portal>\n\t\t\t<SelectPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-popover shadow-md data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\"bg-popover\",\n\t\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\t\"max-h-[var(--radix-select-content-available-height)] data-side-bottom:translate-y-2 data-side-left:-translate-x-2 data-side-right:translate-x-2 data-side-top:-translate-y-2\",\n\t\t\t\t\twidth === \"trigger\" && \"w-[var(--radix-select-trigger-width)]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tposition={position}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<SelectScrollUpButton />\n\t\t\t\t<SelectPrimitive.Viewport\n\t\t\t\t\tclassName={cx(\"p-1\", position === \"popper\" && \"h-[var(--radix-select-trigger-height)] w-full\")}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</SelectPrimitive.Viewport>\n\t\t\t\t<SelectScrollDownButton />\n\t\t\t</SelectPrimitive.Content>\n\t\t</SelectPrimitive.Portal>\n\t),\n);\nSelectContent.displayName = \"SelectContent\";\n\nconst SelectLabel = forwardRef<\n\tElementRef<typeof SelectPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.Label ref={ref} className={cx(\"px-2 py-1.5 text-sm font-semibold\", className)} {...props} />\n));\nSelectLabel.displayName = \"SelectLabel\";\n\nconst SelectItem = forwardRef<\n\tElementRef<typeof SelectPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n\t<SelectPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"relative flex w-full cursor-pointer select-none items-center rounded py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-popover-hover data-state-checked:bg-filled-accent data-state-checked:text-on-filled data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n\t\t<SelectPrimitive.ItemIndicator className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<Check className=\"size-4\" weight=\"bold\" />\n\t\t</SelectPrimitive.ItemIndicator>\n\t</SelectPrimitive.Item>\n));\nSelectItem.displayName = \"SelectItem\";\n\nconst SelectSeparator = forwardRef<ElementRef<typeof Separator>, ComponentPropsWithoutRef<typeof Separator>>(\n\t({ className, ...props }, ref) => (\n\t\t<Separator ref={ref} className={cx(\"-mx-1 my-1 h-px w-auto\", className)} {...props} />\n\t),\n);\nSelectSeparator.displayName = \"SelectSeparator\";\n\nexport {\n\tSelect,\n\tSelectGroup,\n\tSelectValue,\n\tSelectTrigger,\n\tSelectContent,\n\tSelectLabel,\n\tSelectItem,\n\tSelectSeparator,\n\tSelectScrollUpButton,\n\tSelectScrollDownButton,\n};\n"],"mappings":"uGAAA,OAAS,aAAAA,MAAiB,kCAC1B,OAAS,WAAAC,MAAe,gCACxB,OAAS,SAAAC,MAAa,8BACtB,UAAYC,MAAqB,yBACjC,OAAS,OAAAC,MAAW,2BAEpB,OAAS,iBAAAC,EAAe,cAAAC,EAAY,cAAAC,MAAkB,QAanD,cAAAC,EAqCD,QAAAC,MArCC,oBARH,IAAMC,EAA2BC,EAAuE,MAAS,EAK3GC,EAAS,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAM,IAEnCN,EAAiB,OAAhB,CAAsB,GAAGM,EACzB,SAAAN,EAACE,EAAyB,SAAzB,CAAkC,MAAOI,EAAM,cAAc,EAAI,SAAAD,EAAS,EAC5E,EAIIE,EAA8B,QAE9BC,EAA8B,QAE9BC,EAAwBC,EAC7B,kTACA,CACC,SAAU,CACT,MAAO,CACN,OACC,oIACD,QACC,sKACF,CACD,EACA,gBAAiB,CAChB,MAAO,SACR,CACD,CACD,EAIMC,EAAgBC,EAGpB,CAAC,CAAE,UAAAC,EAAW,SAAAR,EAAU,GAAGC,CAAM,EAAGQ,IAAQ,CAC7C,IAAMC,EAAqBC,EAAWd,CAAwB,EACxDe,EAAcX,EAAM,cAAc,GAAKS,EAG7C,OACCd,EAAiB,UAAhB,CACA,IAAKa,EACL,UAAWI,EAAGT,EAAsB,CAAE,MAL1BQ,EAAc,SAAY,SAKM,CAAC,EAAGJ,CAAS,EACxD,GAAGP,EACJ,eAAcW,E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AsB,IAAKc,EAAK,UAAWI,EAAG,oCAAqCL,CAAS,EAAI,GAAGP,EAAO,CAC3G,EACDoB,EAAY,YAAc,cAE1B,IAAMC,EAAaf,EAGjB,CAAC,CAAE,UAAAC,EAAW,SAAAR,EAAU,GAAGC,CAAM,EAAGQ,IACrCb,EAAiB,OAAhB,CACA,IAAKa,EACL,UAAWI,EACV,qQACAL,CACD,EACC,GAAGP,EAEJ,UAAAN,EAAiB,WAAhB,CAA0B,SAAAK,EAAS,EACpCL,EAAiB,gBAAhB,CAA8B,UAAU,gEACxC,SAAAA,EAAC4B,EAAA,CAAM,UAAU,SAAS,OAAO,OAAO,EACzC,GACD,CACA,EACDD,EAAW,YAAc,aAEzB,IAAME,EAAkBjB,EACvB,CAAC,CAAE,UAAAC,EAAW,GAAGP,CAAM,EAAGQ,IACzBd,EAAC8B,EAAA,CAAU,IAAKhB,EAAK,UAAWI,EAAG,yBAA0BL,CAAS,EAAI,GAAGP,EAAO,CAEtF,EACAuB,EAAgB,YAAc","names":["CaretDown","CaretUp","Check","SelectPrimitive","cva","createContext","forwardRef","useContext","jsx","jsxs","SelectAriaInvalidContext","createContext","Select","children","props","SelectGroup","SelectValue","selectTriggerVariants","cva","SelectTrigger","forwardRef","className","ref","ariaInvalidContext","useContext","ariaInvalid","cx","CaretDown","SelectScrollUpButton","CaretUp","SelectScrollDownButton","SelectContent","position","width","SelectLabel","SelectItem","Check","SelectSeparator","Separator"]}
|
|
1
|
+
{"version":3,"sources":["../packages/select/src/select.tsx"],"sourcesContent":["import { CaretDown } from \"@phosphor-icons/react/CaretDown\";\nimport { CaretUp } from \"@phosphor-icons/react/CaretUp\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { cva } from \"class-variance-authority\";\nimport type { ComponentPropsWithoutRef, ElementRef, SelectHTMLAttributes } from \"react\";\nimport { createContext, forwardRef, useContext } from \"react\";\nimport { cx } from \"../../cx\";\nimport { Separator } from \"../../separator\";\nimport type { VariantProps } from \"../../types/src/variant-props\";\n\nconst SelectAriaInvalidContext = createContext<SelectHTMLAttributes<HTMLSelectElement>[\"aria-invalid\"]>(undefined);\n\ntype SelectProps = ComponentPropsWithoutRef<typeof SelectPrimitive.Root> &\n\tPick<SelectHTMLAttributes<HTMLSelectElement>, \"aria-invalid\">;\n\nconst Select = ({ children, ...props }: SelectProps) => {\n\treturn (\n\t\t<SelectPrimitive.Root {...props}>\n\t\t\t<SelectAriaInvalidContext.Provider value={props[\"aria-invalid\"]}>{children}</SelectAriaInvalidContext.Provider>\n\t\t</SelectPrimitive.Root>\n\t);\n};\n\nconst SelectGroup = SelectPrimitive.Group;\n\nconst SelectValue = SelectPrimitive.Value;\n\nconst selectTriggerVariants = cva(\n\t\"flex h-11 w-full items-center justify-between rounded-md border border-form bg-form px-3 py-2 placeholder:text-placeholder hover:bg-form-hover focus:outline-none focus:ring-4 disabled:pointer-events-none disabled:opacity-50 aria-expanded:ring-4 sm:h-9 sm:text-sm [&>span]:line-clamp-1 [&>span]:text-left\",\n\t{\n\t\tvariants: {\n\t\t\tstate: {\n\t\t\t\tdanger:\n\t\t\t\t\t\"border-danger-600 focus:border-danger-600 focus:ring-focus-danger aria-expanded:border-danger-600 aria-expanded:ring-focus-danger\",\n\t\t\t\tdefault:\n\t\t\t\t\t\"borderpform text-strong placeholder:text-placeholder focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tstate: \"default\",\n\t\t},\n\t},\n);\n\ntype SelectTriggerVariants = VariantProps<typeof selectTriggerVariants>;\n\nconst SelectTrigger = forwardRef<\n\tElementRef<typeof SelectPrimitive.Trigger>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => {\n\tconst ariaInvalidContext = useContext(SelectAriaInvalidContext);\n\tconst ariaInvalid = props[\"aria-invalid\"] ?? ariaInvalidContext;\n\tconst state = ariaInvalid ? \"danger\" : (\"default\" satisfies SelectTriggerVariants[\"state\"]);\n\n\treturn (\n\t\t<SelectPrimitive.Trigger\n\t\t\tref={ref}\n\t\t\tclassName={cx(selectTriggerVariants({ state }), className)}\n\t\t\t{...props}\n\t\t\taria-invalid={ariaInvalid}\n\t\t>\n\t\t\t{children}\n\t\t\t<SelectPrimitive.Icon asChild>\n\t\t\t\t<CaretDown className=\"size-4 shrink-0\" weight=\"bold\" />\n\t\t\t</SelectPrimitive.Icon>\n\t\t</SelectPrimitive.Trigger>\n\t);\n});\nSelectTrigger.displayName = \"SelectTrigger\";\n\nconst SelectScrollUpButton = forwardRef<\n\tElementRef<typeof SelectPrimitive.ScrollUpButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollUpButton\n\t\tref={ref}\n\t\tclassName={cx(\"flex cursor-default items-center justify-center py-1\", className)}\n\t\t{...props}\n\t>\n\t\t<CaretUp className=\"size-4\" weight=\"bold\" />\n\t</SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = \"SelectScrollUpButton\";\n\nconst SelectScrollDownButton = forwardRef<\n\tElementRef<typeof SelectPrimitive.ScrollDownButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollDownButton\n\t\tref={ref}\n\t\tclassName={cx(\"flex cursor-default items-center justify-center py-1\", className)}\n\t\t{...props}\n\t>\n\t\t<CaretDown className=\"size-4\" weight=\"bold\" />\n\t</SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = \"SelectScrollDownButton\";\n\ntype SelectContentProps = ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n\twidth?: \"trigger\" | \"content\";\n};\n\nconst SelectContent = forwardRef<ElementRef<typeof SelectPrimitive.Content>, SelectContentProps>(\n\t({ className, children, position = \"popper\", width, ...props }, ref) => (\n\t\t<SelectPrimitive.Portal>\n\t\t\t<SelectPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-popover shadow-md data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\"bg-popover\",\n\t\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\t\"max-h-[var(--radix-select-content-available-height)] data-side-bottom:translate-y-2 data-side-left:-translate-x-2 data-side-right:translate-x-2 data-side-top:-translate-y-2\",\n\t\t\t\t\twidth === \"trigger\" && \"w-[var(--radix-select-trigger-width)]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tposition={position}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<SelectScrollUpButton />\n\t\t\t\t<SelectPrimitive.Viewport\n\t\t\t\t\tclassName={cx(\"p-1\", position === \"popper\" && \"h-[var(--radix-select-trigger-height)] w-full\")}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</SelectPrimitive.Viewport>\n\t\t\t\t<SelectScrollDownButton />\n\t\t\t</SelectPrimitive.Content>\n\t\t</SelectPrimitive.Portal>\n\t),\n);\nSelectContent.displayName = \"SelectContent\";\n\nconst SelectLabel = forwardRef<\n\tElementRef<typeof SelectPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.Label ref={ref} className={cx(\"px-2 py-1.5 text-sm font-semibold\", className)} {...props} />\n));\nSelectLabel.displayName = \"SelectLabel\";\n\nconst SelectItem = forwardRef<\n\tElementRef<typeof SelectPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n\t<SelectPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"relative flex w-full cursor-pointer select-none items-center rounded py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-popover-hover data-state-checked:bg-filled-accent data-state-checked:text-on-filled data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n\t\t<SelectPrimitive.ItemIndicator className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<Check className=\"size-4\" weight=\"bold\" />\n\t\t</SelectPrimitive.ItemIndicator>\n\t</SelectPrimitive.Item>\n));\nSelectItem.displayName = \"SelectItem\";\n\nconst SelectSeparator = forwardRef<ElementRef<typeof Separator>, ComponentPropsWithoutRef<typeof Separator>>(\n\t({ className, ...props }, ref) => (\n\t\t<Separator ref={ref} className={cx(\"-mx-1 my-1 h-px w-auto\", className)} {...props} />\n\t),\n);\nSelectSeparator.displayName = \"SelectSeparator\";\n\nexport {\n\tSelect,\n\tSelectGroup,\n\tSelectValue,\n\tSelectTrigger,\n\tSelectContent,\n\tSelectLabel,\n\tSelectItem,\n\tSelectSeparator,\n\tSelectScrollUpButton,\n\tSelectScrollDownButton,\n};\n"],"mappings":"2EAAA,OAAS,aAAAA,MAAiB,kCAC1B,OAAS,WAAAC,MAAe,gCACxB,OAAS,SAAAC,MAAa,8BACtB,UAAYC,MAAqB,yBACjC,OAAS,OAAAC,MAAW,2BAEpB,OAAS,iBAAAC,EAAe,cAAAC,EAAY,cAAAC,MAAkB,QAanD,cAAAC,EAqCD,QAAAC,MArCC,oBARH,IAAMC,EAA2BC,EAAuE,MAAS,EAK3GC,EAAS,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAM,IAEnCN,EAAiB,OAAhB,CAAsB,GAAGM,EACzB,SAAAN,EAAC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validContext","createContext","Select","children","props","SelectGroup","SelectValue","selectTriggerVariants","cva","SelectTrigger","forwardRef","className","ref","ariaInvalidContext","useContext","ariaInvalid","cx","CaretDown","SelectScrollUpButton","CaretUp","SelectScrollDownButton","SelectContent","position","width","SelectLabel","SelectItem","Check","SelectSeparator","Separator"]}
|
package/dist/separator.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-C2ECUIPG.js";import"./chunk-A5H52ODC.js";export{a as Separator};
|
|
2
2
|
//# sourceMappingURL=separator.js.map
|
package/dist/sheet.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-LFUD45DV.js";import"./chunk-VT3Y7SNW.js";import{a}from"./chunk-A5H52ODC.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 s}from"react";import{jsx as o,jsxs as l}from"react/jsx-runtime";var P=e.Root,u=e.Trigger,b=e.Close,d=e.Portal,n=s(({className:t,...i},r)=>o(e.Overlay,{className:a("fixed inset-0 z-50 bg-overlay backdrop-blur-sm data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0",t),...i,ref:r}));n.displayName=e.Overlay.displayName;var g=y("fixed z-50 flex flex-col bg-dialog shadow-lg transition ease-in-out data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in",{variants:{side:{top:"inset-x-0 top-0 border-b border-dialog data-state-closed:slide-out-to-top data-state-open:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t border-dialog data-state-closed:slide-out-to-bottom data-state-open:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-full border-r border-dialog data-state-closed:slide-out-to-left data-state-open:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-full border-l border-dialog data-state-closed:slide-out-to-right data-state-open:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),p=s(({side:t="right",className:i,children:r,...S},c)=>l(d,{children:[o(n,{}),l(e.Content,{ref:c,className:a(g({side:t}),i),...S,children:[r,o(e.Close,{asChild:!0,children:l(m,{appearance:"outlined",priority:"neutral",className:"absolute right-4 top-4 size-11 sm:size-9",children:[o(v,{className:"size-5 shrink-0"}),o("span",{className:"sr-only",children:"Close"})]})})]})]}));p.displayName=e.Content.displayName;var C=({className:t,...i})=>o("div",{className:a("scrollbar flex-1 overflow-y-auto p-6 text-body",t),...i}),x=({className:t,...i})=>o("div",{className:a("shrink-0 border-b border-dialog-muted px-6 py-4",t),...i}),N=({className:t,...i})=>o("div",{className:a("flex shrink-0 flex-row-reverse gap-2 border-t border-dialog-muted px-6 py-2.5",t),...i}),h=s(({className:t,...i},r)=>o(e.Title,{ref:r,className:a("text-lg font-medium text-strong",t),...i}));h.displayName=e.Title.displayName;var f=s(({className:t,...i},r)=>o(e.Description,{ref:r,className:a("text-body",t),...i}));f.displayName=e.Description.displayName;export{P as Sheet,C as SheetBody,b as SheetClose,p as SheetContent,f as SheetDescription,N as SheetFooter,x as SheetHeader,n as SheetOverlay,d as SheetPortal,h as SheetTitle,u as SheetTrigger};
|
|
2
2
|
//# sourceMappingURL=sheet.js.map
|
package/dist/sheet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/sheet/src/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 { ComponentPropsWithoutRef, ElementRef, forwardRef, HTMLAttributes } from \"react\";\nimport { Button } from \"../../button\";\nimport { cx } from \"../../
|
|
1
|
+
{"version":3,"sources":["../packages/sheet/src/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 { ComponentPropsWithoutRef, ElementRef, forwardRef, HTMLAttributes } from \"react\";\nimport { Button } from \"../../button\";\nimport { cx } from \"../../cx\";\n\nconst Sheet = SheetPrimitive.Root;\n\nconst SheetTrigger = SheetPrimitive.Trigger;\n\nconst SheetClose = SheetPrimitive.Close;\n\nconst SheetPortal = SheetPrimitive.Portal;\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\"fixed inset-0 z-50 bg-overlay backdrop-blur-sm data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0\",\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\"fixed z-50 flex flex-col bg-dialog shadow-lg transition ease-in-out data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in\",\n\t{\n\t\tvariants: {\n\t\t\tside: {\n\t\t\t\ttop: \"inset-x-0 top-0 border-b border-dialog data-state-closed:slide-out-to-top data-state-open:slide-in-from-top\",\n\t\t\t\tbottom:\n\t\t\t\t\t\"inset-x-0 bottom-0 border-t border-dialog data-state-closed:slide-out-to-bottom data-state-open:slide-in-from-bottom\",\n\t\t\t\tleft: \"inset-y-0 left-0 h-full w-full border-r border-dialog data-state-closed:slide-out-to-left data-state-open:slide-in-from-left sm:max-w-sm\",\n\t\t\t\tright:\n\t\t\t\t\t\"inset-y-0 right-0 h-full w-full border-l border-dialog data-state-closed:slide-out-to-right data-state-open:slide-in-from-right sm:max-w-sm\",\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\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\t<SheetPrimitive.Close asChild>\n\t\t\t\t\t<Button appearance=\"outlined\" priority=\"neutral\" className=\"absolute right-4 top-4 size-11 sm:size-9\">\n\t\t\t\t\t\t<X className=\"size-5 shrink-0\" />\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</SheetPrimitive.Close>\n\t\t\t</SheetPrimitive.Content>\n\t\t</SheetPortal>\n\t),\n);\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\nconst SheetBody = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"scrollbar flex-1 overflow-y-auto p-6 text-body\", className)} {...props} />\n);\n\nconst SheetHeader = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"shrink-0 border-b border-dialog-muted px-6 py-4\", className)} {...props} />\n);\n\nconst SheetFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\"flex shrink-0 flex-row-reverse gap-2 border-t border-dialog-muted px-6 py-2.5\", className)}\n\t\t{...props}\n\t/>\n);\n\nconst SheetTitle = forwardRef<\n\tElementRef<typeof SheetPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<SheetPrimitive.Title ref={ref} className={cx(\"text-lg font-medium text-strong\", className)} {...props} />\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\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\", className)} {...props} />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\nexport {\n\tSheet,\n\tSheetBody,\n\tSheetClose,\n\tSheetContent,\n\tSheetDescription,\n\tSheetFooter,\n\tSheetHeader,\n\tSheetOverlay,\n\tSheetPortal,\n\tSheetTitle,\n\tSheetTrigger,\n};\n"],"mappings":"uGAAA,OAAS,KAAAA,MAAS,0BAClB,UAAYC,MAAoB,yBAChC,OAAS,OAAAC,MAA8B,2BACvC,OAA+C,cAAAC,MAAkC,QAgBhF,cAAAC,EAwCI,QAAAC,MAxCJ,oBAZD,IAAMC,EAAuB,OAEvBC,EAA8B,UAE9BC,EAA4B,QAE5BC,EAA6B,SAE7BC,EAAeC,EAGnB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAgB,UAAf,CACA,UAAWW,EACV,iKACAH,CACD,EACC,GAAGC,EACJ,IAAKC,EACN,CACA,EACDJ,EAAa,YAA6B,UAAQ,YAElD,IAAMM,EAAgBC,EACrB,2LACA,CACC,SAAU,CACT,KAAM,CACL,IAAK,8GACL,OACC,uHACD,KAAM,2IACN,MACC,6IACF,CACD,EACA,gBAAiB,CAChB,KAAM,OACP,CACD,CACD,EAKMC,EAAeP,EACpB,CAAC,CAAE,KAAAQ,EAAO,QAAS,UAAAP,EAAW,SAAAQ,EAAU,GAAGP,CAAM,EAAGC,IACnDT,EAACI,EAAA,CACA,UAAAL,EAACM,EAAA,EAAa,EACdL,EAAgB,UAAf,CAAuB,IAAKS,EAAK,UAAWC,EAAGC,EAAc,CAAE,KAAAG,CAAK,CAAC,EAAGP,CAAS,EAAI,GAAGC,EACvF,UAAAO,EACDhB,EAAgB,QAAf,CAAqB,QAAO,GAC5B,SAAAC,EAACgB,EAAA,CAAO,WAAW,WAAW,SAAS,UAAU,UAAU,2CAC1D,UAAAjB,EAACkB,EAAA,CAAE,UAAU,kBAAkB,EAC/BlB,EAAC,QAAK,UAAU,UAAU,iBAAK,GAChC,EACD,GACD,GACD,CAEF,EACAc,EAAa,YAA6B,UAAQ,YAElD,IAAMK,EAAY,CAAC,CAAE,UAAAX,EAAW,GAAGC,CAAM,IACxCT,EAAC,OAAI,UAAWW,EAAG,iDAAkDH,CAAS,EAAI,GAAGC,EAAO,EAGvFW,EAAc,CAAC,CAAE,UAAAZ,EAAW,GAAGC,CAAM,IAC1CT,EAAC,OAAI,UAAWW,EAAG,kDAAmDH,CAAS,EAAI,GAAGC,EAAO,EAGxFY,EAAc,CAAC,CAAE,UAAAb,EAAW,GAAGC,CAAM,IAC1CT,EAAC,OACA,UAAWW,EAAG,gFAAiFH,CAAS,EACvG,GAAGC,EACL,EAGKa,EAAaf,EAGjB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAgB,QAAf,CAAqB,IAAKU,EAAK,UAAWC,EAAG,kCAAmCH,CAAS,EAAI,GAAGC,EAAO,CACxG,EACDa,EAAW,YAA6B,QAAM,YAE9C,IAAMC,EAAmBhB,EAGvB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAgB,cAAf,CAA2B,IAAKU,EAAK,UAAWC,EAAG,YAAaH,CAAS,EAAI,GAAGC,EAAO,CACxF,EACDc,EAAiB,YAA6B,cAAY","names":["X","SheetPrimitive","cva","forwardRef","jsx","jsxs","Sheet","SheetTrigger","SheetClose","SheetPortal","SheetOverlay","forwardRef","className","props","ref","cx","SheetVariants","cva","SheetContent","side","children","Button","X","SheetBody","SheetHeader","SheetFooter","SheetTitle","SheetDescription"]}
|
package/dist/skeleton.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-A5H52ODC.js";import{jsx as a}from"react/jsx-runtime";function o({className:t,...e}){return a("div",{className:r("h-4 animate-pulse rounded-md bg-gray-300/25 dark-high-contrast:bg-black/30 high-contrast:bg-black/30 dark:bg-gray-950/10",t),...e})}export{o as Skeleton};
|
|
2
2
|
//# sourceMappingURL=skeleton.js.map
|
package/dist/skeleton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/skeleton/src/skeleton.tsx"],"sourcesContent":["import { HTMLAttributes } from \"react\";\nimport { cx } from \"../../
|
|
1
|
+
{"version":3,"sources":["../packages/skeleton/src/skeleton.tsx"],"sourcesContent":["import { HTMLAttributes } from \"react\";\nimport { cx } from \"../../cx\";\n\ntype Props = Exclude<HTMLAttributes<HTMLDivElement>, \"children\">;\n\n/**\n * A skeleton is a placeholder for content that is loading.\n * By using a skeleton, you can give the user an idea of what the content will\n * look like and reduce the perceived loading time and CLS (Cumulative Layout Shift).\n *\n * @note Default height is 1rem.\n */\nfunction Skeleton({ className, ...props }: Props) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\t\"h-4 animate-pulse rounded-md bg-gray-300/25 dark-high-contrast:bg-black/30 high-contrast:bg-black/30 dark:bg-gray-950/10\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Skeleton };\n"],"mappings":"wCAcE,cAAAA,MAAA,oBAFF,SAASC,EAAS,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAU,CACjD,OACCH,EAAC,OACA,UAAWI,EACV,2HACAF,CACD,EACC,GAAGC,EACL,CAEF","names":["jsx","Skeleton","className","props","cx"]}
|
package/dist/table.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-A5H52ODC.js";import{forwardRef as b}from"react";import{jsx as T}from"react/jsx-runtime";var r=b(({className:e,...t},a)=>T("table",{ref:a,className:l("relative w-full caption-bottom overflow-auto text-sm",e),...t}));r.displayName="Table";var o=b(({className:e,...t},a)=>T("thead",{ref:a,className:l("bg-base [&_tr]:border-b",e),...t}));o.displayName="TableHeader";var s=b(({className:e,...t},a)=>T("tbody",{ref:a,className:l("[&_tr:last-child]:border-0",e),...t}));s.displayName="TableBody";var m=b(({className:e,...t},a)=>T("tfoot",{ref:a,className:l("border-t border-gray-300 bg-gray-50/50 font-medium [&>tr]:last:border-b-0",e),...t}));m.displayName="TableFooter";var d=b(({className:e,...t},a)=>T("tr",{ref:a,className:l("border-b border-gray-300 hover:bg-gray-200/50 data-state-selected:bg-gray-200",e),...t}));d.displayName="TableRow";var i=b(({className:e,...t},a)=>T("th",{ref:a,className:l("text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0",e),...t}));i.displayName="TableHead";var n=b(({className:e,...t},a)=>T("td",{ref:a,className:l("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));n.displayName="TableCell";var H=b(({className:e,...t},a)=>T("caption",{ref:a,className:l("border-t border-gray-300 py-4 text-sm text-gray-500",e),...t}));H.displayName="TableCaption";export{r as Table,s as TableBody,H as TableCaption,n as TableCell,m as TableFooter,i as TableHead,o as TableHeader,d as TableRow};
|
|
2
2
|
//# sourceMappingURL=table.js.map
|
package/dist/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/table/src/table.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from \"react\";\nimport { cx } from \"../../
|
|
1
|
+
{"version":3,"sources":["../packages/table/src/table.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from \"react\";\nimport { cx } from \"../../cx\";\n\nconst Table = forwardRef<HTMLTableElement, HTMLAttributes<HTMLTableElement>>(({ className, ...props }, ref) => (\n\t// <div className=\"\">\n\t<table ref={ref} className={cx(\"relative w-full caption-bottom overflow-auto text-sm\", className)} {...props} />\n\t// </div>\n));\nTable.displayName = \"Table\";\n\nconst TableHeader = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTableSectionElement>>(\n\t({ className, ...props }, ref) => <thead ref={ref} className={cx(\"bg-base [&_tr]:border-b\", className)} {...props} />,\n);\nTableHeader.displayName = \"TableHeader\";\n\nconst TableBody = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTableSectionElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<tbody ref={ref} className={cx(\"[&_tr:last-child]:border-0\", className)} {...props} />\n\t),\n);\nTableBody.displayName = \"TableBody\";\n\nconst TableFooter = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTableSectionElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<tfoot\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"border-t border-gray-300 bg-gray-50/50 font-medium [&>tr]:last:border-b-0\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTableFooter.displayName = \"TableFooter\";\n\nconst TableRow = forwardRef<HTMLTableRowElement, HTMLAttributes<HTMLTableRowElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<tr\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"border-b border-gray-300 hover:bg-gray-200/50 data-state-selected:bg-gray-200\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTableRow.displayName = \"TableRow\";\n\nconst TableHead = forwardRef<HTMLTableCellElement, ThHTMLAttributes<HTMLTableCellElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<th\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTableHead.displayName = \"TableHead\";\n\nconst TableCell = forwardRef<HTMLTableCellElement, TdHTMLAttributes<HTMLTableCellElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<td ref={ref} className={cx(\"p-4 align-middle [&:has([role=checkbox])]:pr-0\", className)} {...props} />\n\t),\n);\nTableCell.displayName = \"TableCell\";\n\nconst TableCaption = forwardRef<HTMLTableCaptionElement, HTMLAttributes<HTMLTableCaptionElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<caption ref={ref} className={cx(\"border-t border-gray-300 py-4 text-sm text-gray-500\", className)} {...props} />\n\t),\n);\nTableCaption.displayName = \"TableCaption\";\n\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAsE,QAK9E,cAAAC,MAAA,oBAFD,IAAMC,EAAQC,EAA+D,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAEtGL,EAAC,SAAM,IAAKK,EAAK,UAAWC,EAAG,uDAAwDH,CAAS,EAAI,GAAGC,EAAO,CAE9G,EACDH,EAAM,YAAc,QAEpB,IAAMM,EAAcL,EACnB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAAQL,EAAC,SAAM,IAAKK,EAAK,UAAWC,EAAG,0BAA2BH,CAAS,EAAI,GAAGC,EAAO,CACpH,EACAG,EAAY,YAAc,cAE1B,IAAMC,EAAYN,EACjB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzBL,EAAC,SAAM,IAAKK,EAAK,UAAWC,EAAG,6BAA8BH,CAAS,EAAI,GAAGC,EAAO,CAEtF,EACAI,EAAU,YAAc,YAExB,IAAMC,EAAcP,EACnB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzBL,EAAC,SACA,IAAKK,EACL,UAAWC,EAAG,4EAA6EH,CAAS,EACnG,GAAGC,EACL,CAEF,EACAK,EAAY,YAAc,cAE1B,IAAMC,EAAWR,EAChB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzBL,EAAC,MACA,IAAKK,EACL,UAAWC,EAAG,gFAAiFH,CAAS,EACvG,GAAGC,EACL,CAEF,EACAM,EAAS,YAAc,WAEvB,IAAMC,EAAYT,EACjB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzBL,EAAC,MACA,IAAKK,EACL,UAAWC,EACV,mGACAH,CACD,EACC,GAAGC,EACL,CAEF,EACAO,EAAU,YAAc,YAExB,IAAMC,EAAYV,EACjB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzBL,EAAC,MAAG,IAAKK,EAAK,UAAWC,EAAG,iDAAkDH,CAAS,EAAI,GAAGC,EAAO,CAEvG,EACAQ,EAAU,YAAc,YAExB,IAAMC,EAAeX,EACpB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzBL,EAAC,WAAQ,IAAKK,EAAK,UAAWC,EAAG,sDAAuDH,CAAS,EAAI,GAAGC,EAAO,CAEjH,EACAS,EAAa,YAAc","names":["forwardRef","jsx","Table","forwardRef","className","props","ref","cx","TableHeader","TableBody","TableFooter","TableRow","TableHead","TableCell","TableCaption"]}
|
package/dist/text-area.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-A5H52ODC.js";import{cva as g}from"class-variance-authority";import{forwardRef as v,useRef as T,useState as b}from"react";import{jsx as y}from"react/jsx-runtime";var A=g("border-input flex min-h-24 w-full rounded-md border bg-form px-3 py-[calc(theme(spacing[2.5])-1px)] focus-visible:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 data-drag-over:border-dashed data-drag-over:ring-4 sm:py-[calc(theme(spacing[2])-1px)] sm:text-sm",{variants:{invalid:{false:"border-form text-strong ring-focus-accent placeholder:text-placeholder focus:border-accent-600 data-drag-over:border-accent-600",true:"border-danger-600 ring-focus-danger placeholder:text-placeholder focus:border-danger-600 data-drag-over:border-dashed data-drag-over:border-danger-600"},appearance:{monospaced:"font-mono text-[0.9375rem] sm:text-[0.8125rem]"}},defaultVariants:{invalid:!1}}),s=v(({appearance:d,"aria-invalid":i,className:p,invalid:t,onDragEnter:c,onDragLeave:l,onDropCapture:f,...x},r)=>{let m=i??t,[u,a]=b(!1),o=T(null);return y("textarea",{"aria-invalid":m,className:n(A({appearance:d,invalid:t}),p),"data-drag-over":u,onDragEnter:e=>{a(!0),c?.(e)},onDragLeave:e=>{a(!1),l?.(e)},onDropCapture:e=>{a(!1),o.current?.focus(),f?.(e)},ref:e=>{o.current=e,typeof r=="function"?r(e):r&&(r.current=e)},...x})});s.displayName="TextArea";export{s as TextArea};
|
|
2
2
|
//# sourceMappingURL=text-area.js.map
|
package/dist/text-area.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/text-area/src/text-area.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport { forwardRef, useRef, useState } from \"react\";\nimport type { TextareaHTMLAttributes } from \"react\";\nimport { cx } from \"../../
|
|
1
|
+
{"version":3,"sources":["../packages/text-area/src/text-area.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport { forwardRef, useRef, useState } from \"react\";\nimport type { TextareaHTMLAttributes } from \"react\";\nimport { cx } from \"../../cx\";\nimport { VariantProps } from \"../../types\";\n\nconst textAreaVariants = cva(\n\t\"border-input flex min-h-24 w-full rounded-md border bg-form px-3 py-[calc(theme(spacing[2.5])-1px)] focus-visible:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 data-drag-over:border-dashed data-drag-over:ring-4 sm:py-[calc(theme(spacing[2])-1px)] sm:text-sm\",\n\t{\n\t\tvariants: {\n\t\t\t/**\n\t\t\t * Whether or not the textarea has a validation error.\n\t\t\t */\n\t\t\tinvalid: {\n\t\t\t\tfalse:\n\t\t\t\t\t\"border-form text-strong ring-focus-accent placeholder:text-placeholder focus:border-accent-600 data-drag-over:border-accent-600\",\n\t\t\t\ttrue: \"border-danger-600 ring-focus-danger placeholder:text-placeholder focus:border-danger-600 data-drag-over:border-dashed data-drag-over:border-danger-600\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * The visual style of the textarea.\n\t\t\t */\n\t\t\tappearance: {\n\t\t\t\tmonospaced: \"font-mono text-[0.9375rem] sm:text-[0.8125rem]\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tinvalid: false,\n\t\t},\n\t},\n);\n\nexport type TextAreaVariants = VariantProps<typeof textAreaVariants>;\n\nexport type TextAreaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & TextAreaVariants;\n\nconst TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n\t(\n\t\t{ appearance, \"aria-invalid\": _ariaInvalid, className, invalid, onDragEnter, onDragLeave, onDropCapture, ...props },\n\t\tref,\n\t) => {\n\t\tconst ariaInvalid = _ariaInvalid ?? invalid;\n\t\tconst [isDragOver, setIsDragOver] = useState(false);\n\t\tconst _ref = useRef<HTMLTextAreaElement | null>(null);\n\n\t\treturn (\n\t\t\t<textarea\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cx(textAreaVariants({ appearance, invalid }), className)}\n\t\t\t\tdata-drag-over={isDragOver}\n\t\t\t\tonDragEnter={(event) => {\n\t\t\t\t\tsetIsDragOver(true);\n\t\t\t\t\tonDragEnter?.(event);\n\t\t\t\t}}\n\t\t\t\tonDragLeave={(event) => {\n\t\t\t\t\tsetIsDragOver(false);\n\t\t\t\t\tonDragLeave?.(event);\n\t\t\t\t}}\n\t\t\t\tonDropCapture={(event) => {\n\t\t\t\t\tsetIsDragOver(false);\n\t\t\t\t\t_ref.current?.focus();\n\t\t\t\t\tonDropCapture?.(event);\n\t\t\t\t}}\n\t\t\t\tref={(node) => {\n\t\t\t\t\t_ref.current = node;\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nTextArea.displayName = \"TextArea\";\n\nexport { TextArea };\n"],"mappings":"wCAAA,OAAS,OAAAA,MAAW,2BACpB,OAAS,cAAAC,EAAY,UAAAC,EAAQ,YAAAC,MAAgB,QA4C1C,cAAAC,MAAA,oBAvCH,IAAMC,EAAmBC,EACxB,ySACA,CACC,SAAU,CAIT,QAAS,CACR,MACC,kIACD,KAAM,wJACP,EAIA,WAAY,CACX,WAAY,gDACb,CACD,EACA,gBAAiB,CAChB,QAAS,EACV,CACD,CACD,EAMMC,EAAWC,EAChB,CACC,CAAE,WAAAC,EAAY,eAAgBC,EAAc,UAAAC,EAAW,QAAAC,EAAS,YAAAC,EAAa,YAAAC,EAAa,cAAAC,EAAe,GAAGC,CAAM,EAClHC,IACI,CACJ,IAAMC,EAAcR,GAAgBE,EAC9B,CAACO,EAAYC,CAAa,EAAIC,EAAS,EAAK,EAC5CC,EAAOC,EAAmC,IAAI,EAEpD,OACCnB,EAAC,YACA,eAAcc,EACd,UAAWM,EAAGnB,EAAiB,CAAE,WAAAI,EAAY,QAAAG,CAAQ,CAAC,EAAGD,CAAS,EAClE,iBAAgBQ,EAChB,YAAcM,GAAU,CACvBL,EAAc,EAAI,EAClBP,IAAcY,CAAK,CACpB,EACA,YAAcA,GAAU,CACvBL,EAAc,EAAK,EACnBN,IAAcW,CAAK,CACpB,EACA,cAAgBA,GAAU,CACzBL,EAAc,EAAK,EACnBE,EAAK,SAAS,MAAM,EACpBP,IAAgBU,CAAK,CACtB,EACA,IAAMC,GAAS,CACdJ,EAAK,QAAUI,EACX,OAAOT,GAAQ,WAClBA,EAAIS,CAAI,EACET,IACVA,EAAI,QAAUS,EAEhB,EACC,GAAGV,EACL,CAEF,CACD,EACAT,EAAS,YAAc","names":["cva","forwardRef","useRef","useState","jsx","textAreaVariants","cva","TextArea","forwardRef","appearance","_ariaInvalid","className","invalid","onDragEnter","onDragLeave","onDropCapture","props","ref","ariaInvalid","isDragOver","setIsDragOver","useState","_ref","useRef","cx","event","node"]}
|
package/dist/theme-provider.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as T}from"./chunk-
|
|
1
|
+
import{a as T}from"./chunk-IGCOSMVM.js";import v from"clsx";import{createContext as D,useContext as L,useEffect as P,useMemo as S,useState as F}from"react";import W from"tiny-invariant";import{Fragment as q,jsx as M}from"react/jsx-runtime";var C="https://cdn.ngrok.com/static/fonts",I=["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"],H=e=>[C,e].join("/"),u=()=>M(q,{children:I.map(e=>M("link",{rel:"preload",href:H(e),as:"font",type:"font/woff",crossOrigin:"anonymous"},e))});import{Fragment as R,jsx as p,jsxs as G}from"react/jsx-runtime";var i="(prefers-color-scheme: dark)",a="(prefers-contrast: more)",g=["system","light","dark","light-high-contrast","dark-high-contrast"],B=e=>e;function b(e){return typeof e!="string"?!1:g.includes(e)}var l="mantle-ui-theme",N=["system",()=>null],k=D(N),w=()=>typeof window<"u";function d(e,t="system"){let r=t??"system";if(w()){let n=window.localStorage.getItem(e);return b(n)?n:r}return r}function $({children:e,defaultTheme:t="system",storageKey:r=l}){let[n,s]=F(()=>{let o=d(r,t);return c(o),o});P(()=>{let o=d(r,t);s(o),c(o)},[t,r]),P(()=>{let o=window.matchMedia(i),m=window.matchMedia(a),h=()=>{d(r,t)==="system"&&c("system")};return o.addEventListener("change",h),m.addEventListener("change",h),()=>{o.removeEventListener("change",h),m.removeEventListener("change",h)}},[t,r]);let f=S(()=>[n,o=>{window.localStorage.setItem(r,o),s(o),c(o)}],[r,n]);return p(k.Provider,{value:f,children:e})}function x(){let e=L(k);return W(e,"useTheme must be used within a ThemeProvider"),e}function c(e){if(!w())return;let t=window.document.documentElement;t.classList.remove(...g);let r=window.matchMedia(i).matches,n=window.matchMedia(a).matches,s=y(e,{prefersDarkMode:r,prefersHighContrast:n});t.classList.add(s),t.dataset.appliedTheme=s,t.dataset.theme=e}function y(e,{prefersDarkMode:t,prefersHighContrast:r}){return e==="system"?O({prefersDarkMode:t,prefersHighContrast:r}):e}function A(){let[e]=x(),t=T(i),r=T(a);return y(e,{prefersDarkMode:t,prefersHighContrast:r})}function O({prefersDarkMode:e,prefersHighContrast:t}){return t?e?"dark-high-contrast":"light-high-contrast":e?"dark":"light"}function E({defaultTheme:e="system",storageKey:t=l}){return`
|
|
2
2
|
(function() {
|
|
3
3
|
const themes = ${JSON.stringify(g)};
|
|
4
4
|
const isTheme = (value) => typeof value === "string" && themes.includes(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/theme-provider/src/theme-provider.tsx","../packages/theme-provider/src/preload-fonts.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport type { PropsWithChildren } from \"react\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { useMatchesMediaQuery } from \"../../core/src/use-matches-media-query\";\nimport { PreloadFonts } from \"./preload-fonts\";\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 * themes is a tuple of valid themes.\n */\nconst themes = [\"system\", \"light\", \"dark\", \"light-high-contrast\", \"dark-high-contrast\"] 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>(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 * 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\tconst storedTheme = window.localStorage.getItem(storageKey);\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\twindow.localStorage.setItem(storageKey, theme);\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 * 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}) {\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\tconst maybeStoredTheme = window.localStorage.getItem(\"${storageKey}\");\n\tconst hasStoredTheme = isTheme(maybeStoredTheme);\n\tif (!hasStoredTheme) {\n\t\twindow.localStorage.setItem(\"${storageKey}\", fallbackTheme);\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\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}: {\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n}) => (\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 />\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 type { Theme, ThemeProviderProps };\nexport {\n\tisTheme,\n\tMantleThemeHeadContent,\n\tpreventWrongThemeFlashScriptContent,\n\ttheme,\n\tThemeProvider,\n\tuseAppliedTheme,\n\tuseInitialHtmlThemeProps,\n\tuseTheme,\n};\n","const cdnBase = \"https://cdn.ngrok.com/static/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: T) => [cdnBase, font].join(\"/\");\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 = () => (\n\t<>\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</>\n);\n\nexport { PreloadFonts };\n"],"mappings":"wCAAA,OAAOA,MAAU,OAEjB,OAAS,iBAAAC,EAAe,cAAAC,EAAY,aAAAC,EAAW,WAAAC,EAAS,YAAAC,MAAgB,QACxE,OAAOC,MAAe,iBCoBrB,mBAAAC,EAEE,OAAAC,MAFF,oBAvBD,IAAMC,EAAU,qCAEVC,EAAQ,CACb,+CACA,qDACA,8CACA,gDACA,oDACA,sCACA,4CACA,0CACA,+CACD,EAIMC,EAA4BC,GAAY,CAACH,EAASG,CAAI,EAAE,KAAK,GAAG,EAMhEC,EAAe,IACpBL,EAAAD,EAAA,CACE,SAAAG,EAAM,IAAKE,GACXJ,EAAC,QAAgB,IAAI,UAAU,KAAMG,EAASC,CAAI,EAAG,GAAG,OAAO,KAAK,YAAY,YAAY,aAAjFA,CAA6F,CACxG,EACF,ED+GO,OAgIP,YAAAE,EAhIO,OAAAC,EAgIP,QAAAC,MAhIO,oBAhIR,IAAMC,EAA4B,+BAK5BC,EAAgC,2BAKhCC,EAAS,CAAC,SAAU,QAAS,OAAQ,sBAAuB,oBAAoB,EAUhFC,EAA0BC,GAAaA,EAK7C,SAASC,EAAQD,EAAgC,CAChD,OAAI,OAAOA,GAAU,SACb,GAGDF,EAAO,SAASE,CAAc,CACtC,CAKA,IAAME,EAAsB,kBAUtBC,EAAmC,CAAC,SAAU,IAAM,IAAI,EAKxDC,EAAuBC,EAAkCF,CAAY,EAKrEG,EAAY,IAAM,OAAO,OAAW,IAK1C,SAASC,EAAeC,EAAoBC,EAAsB,SAAU,CAC3E,IAAMC,EAA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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAe7E,KAAK,CACP,CAMA,IAAMuC,EAAyB,CAAC,CAC/B,aAAA3B,EAAe,SACf,WAAAD,EAAaN,CACd,IAICP,EAAAF,EAAA,CACC,UAAAC,EAAC,UACA,wBAAyB,CACxB,OAAQyC,EAAoC,CAAE,aAAA1B,EAAc,WAAAD,CAAW,CAAC,CACzE,EACD,EACAd,EAAC2C,EAAA,EAAa,GACf,EAYD,SAASC,EAAyBC,EAIZ,CACrB,GAAM,CAAE,UAAAC,EAAY,GAAI,aAAA/B,EAAe,SAAU,WAAAD,EAAaN,CAAoB,EAAIqC,GAAS,CAAC,EAEhG,OAAOjB,EAAQ,IAAM,CACpB,GAAI,CAAChB,EAAU,EACd,MAAO,CACN,UAAWmC,EAAKD,CAAS,EACzB,qBAAsB,SACtB,aAAc,QACf,EAGD,IAAMZ,EAAkB,OAAO,WAAWhC,CAAyB,EAAE,QAC/DiC,EAAsB,OAAO,WAAWhC,CAA6B,EAAE,QACvEmB,EAAeT,EAAeC,EAAYC,CAAY,EACtDiC,EAAeX,EAAaf,EAAc,CAAE,gBAAAY,EAAiB,oBAAAC,CAAoB,CAAC,EAExF,MAAO,CACN,UAAWY,EAAKD,EAAWE,CAAY,EACvC,qBAAsBA,EACtB,aAAc1B,CACf,CACD,EAAG,CAACwB,EAAW/B,EAAcD,CAAU,CAAC,CACzC","names":["clsx","createContext","useContext","useEffect","useMemo","useState","invariant","Fragment","jsx","cdnBase","fonts","fontHref","font","PreloadFonts","Fragment","jsx","jsxs","prefersDarkModeMediaQuery","prefersHighContrastMediaQuery","themes","theme","value","isTheme","DEFAULT_STORAGE_KEY","initialState","ThemeProviderContext","createContext","isBrowser","getStoredTheme","storageKey","defaultTheme","fallbackTheme","storedTheme","ThemeProvider","children","setTheme","useState","initialTheme","applyTheme","useEffect","prefersDarkMql","prefersHighContrastMql","onChange","useMemo","useTheme","context","useContext","invariant","htmlElement","prefersDarkMode","prefersHighContrast","newTheme","resolveTheme","determineThemeFromMediaQuery","useAppliedTheme","useMatchesMediaQuery","preventWrongThemeFlashScriptContent","MantleThemeHeadContent","PreloadFonts","useInitialHtmlThemeProps","props","className","clsx","reolvedTheme"]}
|
|
1
|
+
{"version":3,"sources":["../packages/theme-provider/src/theme-provider.tsx","../packages/theme-provider/src/preload-fonts.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport type { PropsWithChildren } from \"react\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { useMatchesMediaQuery } from \"../../hooks/src/use-matches-media-query\";\nimport { PreloadFonts } from \"./preload-fonts\";\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 * themes is a tuple of valid themes.\n */\nconst themes = [\"system\", \"light\", \"dark\", \"light-high-contrast\", \"dark-high-contrast\"] 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>(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 * 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\tconst storedTheme = window.localStorage.getItem(storageKey);\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\twindow.localStorage.setItem(storageKey, theme);\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 * 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}) {\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\tconst maybeStoredTheme = window.localStorage.getItem(\"${storageKey}\");\n\tconst hasStoredTheme = isTheme(maybeStoredTheme);\n\tif (!hasStoredTheme) {\n\t\twindow.localStorage.setItem(\"${storageKey}\", fallbackTheme);\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\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}: {\n\tdefaultTheme?: Theme;\n\tstorageKey?: string;\n}) => (\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 />\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 type { Theme, ThemeProviderProps };\nexport {\n\tisTheme,\n\tMantleThemeHeadContent,\n\tpreventWrongThemeFlashScriptContent,\n\ttheme,\n\tThemeProvider,\n\tuseAppliedTheme,\n\tuseInitialHtmlThemeProps,\n\tuseTheme,\n};\n","const cdnBase = \"https://cdn.ngrok.com/static/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: T) => [cdnBase, font].join(\"/\");\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 = () => (\n\t<>\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</>\n);\n\nexport { PreloadFonts };\n"],"mappings":"wCAAA,OAAOA,MAAU,OAEjB,OAAS,iBAAAC,EAAe,cAAAC,EAAY,aAAAC,EAAW,WAAAC,EAAS,YAAAC,MAAgB,QACxE,OAAOC,MAA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,CAAC,EAEhG,OAAOjB,EAAQ,IAAM,CACpB,GAAI,CAAChB,EAAU,EACd,MAAO,CACN,UAAWmC,EAAKD,CAAS,EACzB,qBAAsB,SACtB,aAAc,QACf,EAGD,IAAMZ,EAAkB,OAAO,WAAWhC,CAAyB,EAAE,QAC/DiC,EAAsB,OAAO,WAAWhC,CAA6B,EAAE,QACvEmB,EAAeT,EAAeC,EAAYC,CAAY,EACtDiC,EAAeX,EAAaf,EAAc,CAAE,gBAAAY,EAAiB,oBAAAC,CAAoB,CAAC,EAExF,MAAO,CACN,UAAWY,EAAKD,EAAWE,CAAY,EACvC,qBAAsBA,EACtB,aAAc1B,CACf,CACD,EAAG,CAACwB,EAAW/B,EAAcD,CAAU,CAAC,CACzC","names":["clsx","createContext","useContext","useEffect","useMemo","useState","invariant","Fragment","jsx","cdnBase","fonts","fontHref","font","PreloadFonts","Fragment","jsx","jsxs","prefersDarkModeMediaQuery","prefersHighContrastMediaQuery","themes","theme","value","isTheme","DEFAULT_STORAGE_KEY","initialState","ThemeProviderContext","createContext","isBrowser","getStoredTheme","storageKey","defaultTheme","fallbackTheme","storedTheme","ThemeProvider","children","setTheme","useState","initialTheme","applyTheme","useEffect","prefersDarkMql","prefersHighContrastMql","onChange","useMemo","useTheme","context","useContext","invariant","htmlElement","prefersDarkMode","prefersHighContrast","newTheme","resolveTheme","determineThemeFromMediaQuery","useAppliedTheme","useMatchesMediaQuery","preventWrongThemeFlashScriptContent","MantleThemeHeadContent","PreloadFonts","useInitialHtmlThemeProps","props","className","clsx","reolvedTheme"]}
|
package/dist/tooltip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-A5H52ODC.js";import{Content as p,Provider as s,Root as f,Trigger as l}from"@radix-ui/react-tooltip";import{forwardRef as m}from"react";import{jsx as n}from"react/jsx-runtime";var T=({delayDuration:o=0,...t})=>n(s,{delayDuration:o??0,...t}),C=f,g=l,i=m(({children:o,className:t,sideOffset:r=4,...d},a)=>n(p,{ref:a,sideOffset:r,className:e("z-50 overflow-hidden rounded-md bg-tooltip px-3 py-1.5 text-sm text-tooltip shadow animate-in fade-in-0 zoom-in-95 data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95",t),...d,children:o}));i.displayName="TooltipContent";export{C as Tooltip,i as TooltipContent,T as TooltipProvider,g as TooltipTrigger};
|
|
2
2
|
//# sourceMappingURL=tooltip.js.map
|